我在这里遇到了一个很大的问题。 我使用 ocLazyLoader 加载完整日历并且运行良好,但是当我尝试包含 fullCalendar-scheduler 时,我在 JavaScript 中遇到此错误。
Uncaught TypeError: Cannot set property 'schedulerVersion' of undefined
看起来它无法在插件的源代码中设置等于$.fullCalendar
的变量。
以下是我实例化文件的方法:
resolve: {
resources: function($ocLazyLoad) {
return $ocLazyLoad.load([
ASSETS.forms.multiSelect
])
},fullCalendarScheduler: function($ocLazyLoad){
return $ocLazyLoad.load([
ASSETS.core.moment,
ASSETS.extra.scheduler,
]);
},
fullCalendar: function($ocLazyLoad){
return $ocLazyLoad.load([
ASSETS.extra.fullCalendar
]);
},
}
我也在 Controller 中传递了正确的值。
controller('AccueilCtrl', ['$scope', '$filter', 'fullCalendar', 'fullCalendarScheduler', function($scope, $filter, fullCalendar, fullCalendarScheduler) {
关于如何解决这个问题有什么想法吗?
最佳答案
通过 jQuery 的 $.getScript(url);
方法动态加载日历文件时遇到了同样的问题,我遇到了这篇文章。谢谢,Nick ,发布您的解决方案!
更改加载顺序后,一切正常。 我的加载顺序是:
第一个 - 加载所有 css
第二 - 按此顺序加载 js:
- moment.min.js
- fullcalendar.min.js
- scheduler.min.js
- bootstrap.min.js
- ...
希望这对其他人有帮助。
关于javascript - Fullcalendar-scheduler 无法设置未定义的属性 'scheduler Version',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41234357/