我已经注意到其他 kendo-ui 控件的这个问题,但我会特别询问有关 kendo-notification 的问题。我的html有:
<span kendo-notification="vm.notifier"></span>
<button ng-click="vm.push()">Push it</button>
在我的控制器中,我有:
(function () {
'use strict';
angular
.module('app.layout')
.controller('Shell', Shell);
function Shell() {
/*jshint validthis: true */
var vm = this;
vm.push = push;
activate();
function activate() {
vm.notifier.show('Loaded', 'info');
}
function push() {
vm.notifier.show('Pushed', 'info');
}
}
})();
我的问题:如果我点击按钮,我会收到通知。但是,在加载时,我得到: TypeError: Cannot read property 'show' of undefined at activate ( http://localhost:57624/app/layout/shell.controller.js:41:24 ) at new Shell ( http:// /localhost:57624/app/layout/shell.controller.js:32:9 )
我确定我在 Angular 中遗漏了一些关于对象状态的信息,但是我错过了什么我无法在控制器的加载阶段显示此通知?