0
我正在嘗試向github上的Hygieia項目添加小部件。當我的小部件添加到頁面中,它不顯示,我得到這個錯誤:找不到角度js中未定義的視圖,模塊定義
TypeError: Cannot read property 'view' of undefined
at link (http://localhost:3000/app/dashboard/directives/widget.js:49:64)
at http://localhost:3000/bower_components/bower.js:9682:44
at invokeLinkFn (http://localhost:3000/bower_components/bower.js:9688:9)
at nodeLinkFn (http://localhost:3000/bower_components/bower.js:9198:11)
at delayedNodeLinkFn (http://localhost:3000/bower_components/bower.js:9446:11)
at compositeLinkFn (http://localhost:3000/bower_components/bower.js:8547:13)
at compositeLinkFn (http://localhost:3000/bower_components/bower.js:8550:13)
at compositeLinkFn (http://localhost:3000/bower_components/bower.js:8550:13)
at compositeLinkFn (http://localhost:3000/bower_components/bower.js:8550:13)
at compositeLinkFn (http://localhost:3000/bower_components/bower.js:8550:13) <widget name="aws-status" class="ng-isolate-scope">
我已經仿照所有我已經存在類似的模塊的代碼之後添加的代碼,但由於某種原因該小部件將不會顯示在頁面上。這裏就是我聲明瞭該模塊,讓我知道如果你需要看到任何其他的代碼段,以確定什麼,我做錯了:
(function() {
'use strict';
var widget_state,
config = {
view: {
defaults: {
title: 'AWS Status' // widget title
},
controller: 'awsStatusViewController',
controllerAs: 'ctrl',
templateUrl: 'components/widgets/awsstatus/view.html'
},
config: {
controller: 'awsStatusConfigController',
controllerAs: 'ctrl',
templateUrl: 'components/widgets/awsstatus/config.html'
},
getState: getState
};
angular
.module(HygieiaConfig.module)
.config(register);
register.$inject = ['widgetManagerProvider', 'WidgetState'];
function register(widgetManagerProvider, WidgetState) {
widget_state = WidgetState;
widgetManagerProvider.register('aws-status', config);
}
function getState(widgetConfig) {
return HygieiaConfig.local ?
widget_state.READY :
(widgetConfig.id ? widget_state.READY : widget_state.CONFIGURE);
}
});