我有一个在角度控制器上创建的动态剑道表,该表是在单击事件之后创建的,在一些表列中有angular指令。指令没有编译,模板不工作,我得到了空白单元格。代码:
$("#grid" + index).kendoGrid({
dataSource: {
transport: {
read: {
url: context.param.url.GetData(),
type: "post",
dataType: "json",
data:
function () {
return {
FromDate: obj.CalcDate,
ToDate: obj.CalcDate,
}
}
}
},
schema: {
data: "Data",
total: "Total"
},
pageSize: 5,
serverPaging: true,
serverSorting: true,
serverFiltering: true
},
scrollable: false,
sortable: true,
pageable: true,
columns: [
{
field: "AgregationProgramSum",
title: resource["Productivity_Company_GridAgregationProgramSum"],
template: "<div custom-directive=#: AgregationProgramSum # ></div>"
},
]
});我在《合唱揭秘》中看到,这些价值观很好。bur指令没有发生
发布于 2017-05-19 01:27:03
你的指令的代码在哪里?您应该只需要在网格的模板中“使用”您的指令。
以下是我的指令:
angular.module("KendoDemos")
.directive('myDirective', function($compile) {
return {
restrict: 'E',
scope: {
list: '='
},
template: '<div ng-repeat="item in list">{{item.name}}</div>',
replace: true,
//require: 'ngModel',
link: function($scope, elem, attr, ctrl) {
}
};
});下面是我的网格列using指令:
columns: [{
field: "FirstName",
title: "First Name",
width: "120px"
},{
field: "LastName",
title: "Last Name",
width: "120px"
},{
field: "Country",
width: "120px",
hidden: true
},{
field: "City",
width: "120px"
},{
field: "Title",
template: "<my-directive data-list='paint'></my-directive>"
}],这是有效的Dojo。也许你的指令有问题。很难在实际看到你的代码的时候说出来。希望这能有所帮助。
https://stackoverflow.com/questions/44016626
复制相似问题