[英]kendo ui custom widget angular directive
I have extended kendo grid 我已经扩展了剑道网格
(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);
How to use custom widget in angular way. 如何以有角度的方式使用自定义小部件。
Currently I am able to see the new directive is creating successfully, but not interpolating. 目前,我可以看到新指令正在成功创建,但无法插值。
According to the telerik forum discussion here: 根据这里的telerik论坛讨论:
http://www.telerik.com/forums/extending-the-grid-in-angular-kendo-does-not-work http://www.telerik.com/forums/extending-the-grid-in-angular-kendo-does-not-work
The problem seems to be in this block of code in kendo.angular.js:
问题似乎出在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"); });
This causes all calls to
kendo.ui.plugin()
to be intercepted and forcreateDirectives()
to be called on the passed in class.这将导致对
kendo.ui.plugin()
所有调用被拦截,并在传入的类上调用createDirectives()
。 The problem is that a kendoGrid directive has already been created for the default non-extended grid, and so whenkendo.ui.plugin()
is called again for the new extended grid, a second kendoGrid directive is created which causes AngularJS to throw a multiple directive error.问题是已经为默认的非扩展网格创建了kendoGrid指令,因此当再次为新的扩展网格调用
kendo.ui.plugin()
时,将创建第二个kendoGrid指令,这将导致AngularJS抛出多指令错误。
As you can read in the official answer, Telerik doesn't support user-extended widgets. 正如您在官方答案中看到的那样,Telerik不支持用户扩展的小部件。
All this being said, I'm currently investigating using Angular decorators to actually extend the directives created by Kendo for its widgets, as described here: 综上所述,我目前正在研究使用Angular装饰器来实际扩展Kendo为其小部件创建的指令,如下所述:
https://coderwall.com/p/-8vjxa/cleanly-extend-3rd-party-angularjs-directives https://coderwall.com/p/-8vjxa/cleanly-extend-3rd-party-angularjs-directives
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.