This is a migrated thread and some comments may be shown as answers.

Calling angular controller method from kendo template?

1 Answer 142 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Xavier
Top achievements
Rank 1
Xavier asked on 05 Sep 2014, 08:23 PM
How to call an angular controller method from kendo template? Controller is defined as data-ng-controller="feedbacksSurveyReportCtrl as vm" and the call to vm.couponStatusAsString fails with vm as undefined.



<script type="text/x-kendo-template" id="responder-template">
    <table class="table table-striped">
        <tbody>
            <tr>
                <th>Name</th>
                <th>Redeemed Date</th>
                <th>Coupon Status</th>
            </tr>
            # for (var i = 0; i < coupons.length; i++) { #
            <tr>
                <td>#= coupons[i].name #</td>
                <td>
                    #= kendo.toString(new Date(coupons[i].redeemedDate), "g") #
                </td>
                <td>
                    #= vm.couponStatusAsString(coupons[i].status) #
                </td>
            </tr>
            # } #
        </tbody>
    </table>
    </div>
    #}#
</script>

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 09 Sep 2014, 01:07 PM
Hi Xavier,

I am afraid that this scenario is not supported - the kendo templates are not aware of the angular controller context. You should use the angular template syntax for that purpose. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Templates
Asked by
Xavier
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or