我想在我的网页上显示一个日历,如果我不把'ui.calendar‘放在angular.module()中,下面的代码就可以正常工作,但在这种情况下,日历不会被显示,如果我把它添加到angular.module()中,它会显示上面的错误。请帮帮我!
这是我的两个javascript文件
'use strict';
angular.module('sangamApp')
.config(['$stateProvider',function ($stateProvider) {
$stateProvider
.state('calendar', {
url: '/calendar',
template: '<calendar></calendar>'
});
}]);
'use strict';
(function(){
class CalendarComponent {
constructor() {
this.eventSources = [];
this.uiConfig = {
calendar : {
editable : true,
header : {
left : 'prev,next,today',
centre : 'title',
right : 'month,agendaWeek,agendaDay'
}
}
}
}
}
angular.module('sangamApp',['ui.calendar'])
.component('calendar', {
templateUrl: 'app/calendar/calendar.html',
controller: CalendarComponent
});
})();
发布于 2016-06-25 11:57:48
您使用了$stateProvider
,但是您忘记将ui.router
放在模块依赖项中。
angular.module('sangamApp',['ui.calendar', 'ui.router']) // added ui.router
发布于 2016-06-25 12:09:46
在第一次声明时,您需要将所有模块依赖项的列表作为第二个参数传递给angular.module
,而且由于您使用的是$stateProvider
,因此应该在依赖项列表中指定ui.router
angular.module('sangamApp',['ui.calendar', 'ui.router'])
https://stackoverflow.com/questions/38028152
复制