【发布时间】:2015-08-03 20:18:20
【问题描述】:
我的 Kendo UI 工具栏有问题。实际上,每个按钮都是在工具栏初始化期间加载的。
但有些要求要求动态添加按钮。
这是我们如何在页面控制器中加载按钮的示例:
...
$scope.toolbarButtons = [{
type: 'button',
text: 'Button 1',
click: 'clickButton1'
}, {
type: 'toggleButton',
text: 'Button 2'
}, {
type: 'button',
text: 'Button 3'
}
...
以及我们如何添加工具栏并将按钮传递给指令:
<toolbar buttons="toolbarButtons"></toolbar>
return {
scope: false,
restrict: 'E',
template: '<div kendo-toolbar="toolbar"></div>',
controller: 'ToolbarController',
link: function ($scope, element, attr) {
$scope.buttons = $scope[attr.buttons];
// Code to manage the toolbar
...
};
我尝试更改按钮数组的范围绑定:
scope: {
buttons: '='
}
但是当我在toolbarButtons数组中添加一个按钮时,按钮是不显示的。
【问题讨论】:
标签: javascript arrays angularjs angularjs-directive kendo-ui