Fullcalendar-scheduler 无法设置未定义的 属性 'scheduler Version'

Fullcalendar-scheduler cannot set property 'scheduler Version' of undefined

我在这里遇到了很多问题。 我使用 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('AccueilCtrl', ['$scope', '$filter', 'fullCalendar', 'fullCalendarScheduler', function($scope, $filter, fullCalendar, fullCalendarScheduler) {

关于如何解决这个问题有什么想法吗?

对于遇到此问题的人,我找到了解决方法。我不知道这样做是否正确,但确实有效。
Fullcalendar 需要特定订单才能导入所需文件。使用 OcLazyLoad,您可以使用 files: [] 参数确定此顺序。例如:

fullCalendar: function($ocLazyLoad){
                return $ocLazyLoad.load({
                    files: [
                        appHelper.assetPath('js/fullCalendar/3.1.0/fullcalendar.min.css'),
                        appHelper.assetPath('js/scheduler/1.5.0/scheduler.min.css'),
                        appHelper.assetPath('js/moment.min.js'),
                        appHelper.assetPath('js/fullCalendar/3.1.0/fullcalendar.min.js'),
                        appHelper.assetPath('js/scheduler/1.5.0/scheduler.min.js')
                    ]
                });
            }

这样,我就能够按要求的顺序导入所需的文件。您也可以将 css 与 ASSETS 中的 js 分开,然后以正确的顺序导入它。

通过 jQuery 的 $.getScript(url); 方法动态加载日历文件时遇到同样的问题,我遇到了这个 post。谢谢,Nick,post你的解决方案!

更改加载顺序后,一切正常。 我的加载顺序是:

第 1 - 全部加载 css

第 2 - 按此顺序加载 js:

  • moment.min.js
  • fullcalendar.min.js
  • scheduler.min.js
  • bootstrap.min.js
  • ...

希望这对其他人有帮助。