[英]kendo ui custom widget angular directive
我已经扩展了剑道网格
(function($) {
var MyGrid = kendo.ui.Grid.extend({
init: function(element, options) {
kendo.ui.Grid.fn.init.call(this, element, options);
},
options: {
name: 'MyGrid'
}
})
kendo.ui.plugin(MyGrid);
})(jQuery);
如何以有角度的方式使用自定义小部件。
目前,我可以看到新指令正在成功创建,但无法插值。
根据这里的telerik论坛讨论:
http://www.telerik.com/forums/extending-the-grid-in-angular-kendo-does-not-work
问题似乎出在kendo.angular.js的以下代码块中:
defadvice(kendo.ui, "plugin", function(klass, register, prefix){ this.next(); pendingPatches = $.grep(pendingPatches, function(args){ return !defadvice.apply(null, args); }); createDirectives(klass, prefix == "Mobile"); });
这将导致对
kendo.ui.plugin()
所有调用被拦截,并在传入的类上调用createDirectives()
。 问题是已经为默认的非扩展网格创建了kendoGrid指令,因此当再次为新的扩展网格调用kendo.ui.plugin()
时,将创建第二个kendoGrid指令,这将导致AngularJS抛出多指令错误。
正如您在官方答案中看到的那样,Telerik不支持用户扩展的小部件。
综上所述,我目前正在研究使用Angular装饰器来实际扩展Kendo为其小部件创建的指令,如下所述:
https://coderwall.com/p/-8vjxa/cleanly-extend-3rd-party-angularjs-directives
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.