剑道模板按钮ng-click无法正常工作

时间:2016-03-07 06:55:03

标签: angularjs kendo-ui kendo-grid

模板中的Kendo ng -click按钮不起作用。帮助我们!

<div ng-controller="RiskProcessController">
   <script id="link-template" type="text/kendo-templ">  
        <button id="nextButton" class="btn btn-primary newButton" ng-click="Test()"> Click</button>
     </script>
 </div>

角度控制器

manageApp.controller("RiskProcessController", ['$scope', '$http', '$uibModal',  function ($scope, $http, $uibModal, riskServices) {
   $("#Risks").kendoGrid({
        dataSource: dataSource,
        detailTemplate: kendo.template($("#link-template").html()),
        detailInit: detailInit,
        columns: []
     }
    $scope.Test = function(){
     console.log("test");
    }
}]);

1 个答案:

答案 0 :(得分:1)

您正在使用jQuery语法初始化KendoGrid,这是不推荐的,并且会给您带来问题。

相反,为什么不使用Kendo提供的Angular / Kendo指令?

请阅读有关如何操作的文档:http://demos.telerik.com/kendo-ui/grid/angular

如果你这样做,那么你可以做类似的事情;

<div kendo-grid k-options="gridOptions" ng-controller="RiskProcessController">
    // grid code
</div>

manageApp.controller("RiskProcessController", ['$scope', '$http', '$uibModal',  function ($scope, $http, $uibModal, riskServices) {

    $scope.mainGridOptions = {
        dataSource: {},
        sortable: true,
        pageable: true,
        dataBound: function() {
            columns: []
        };
    }
}]);