Angular UI-Calendar TypeError:calendar.fullCalendar不是一个函数 [英] Angular UI-Calendar TypeError: calendar.fullCalendar is not a function

查看:157
本文介绍了Angular UI-Calendar TypeError:calendar.fullCalendar不是一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将Angular:ui-calendar与流星一起使用,但出现此错误.

I been trying to use Angular: ui-calendar with meteor, but get this error.

TypeError: calendar.fullCalendar is not a function
    at Scope.scope.initCalendar (calendar.js:265)
    at Object.fn (calendar.js:337)
    at Scope.$digest (angular.js:15896)
    at Scope.$apply (angular.js:16160)
    at bootstrapApply (angular.js:1679)
    at Object.invoke (angular.js:4523)
    at doBootstrap (angular.js:1677)
    at Object.bootstrap (angular.js:1697)
    at HTMLDocument.onReady (app.js:47)
    at fire (jquery.js:3143)

在流星包裹中,我很容易:

In meteor packages i habe:

角1.2.3 angularui:ui日历

angular 1.2.3 angularui:ui-calendar

还尝试使用直接插入的包而不使用流星添加. 但是使用calendar.js文件(这是不同的)

also tried to use the package inserted directly not using meteor add. but using the calendar.js file (which is different)

两者都遇到相同的错误.

Both get the same error.

对此进行了尝试: https://github.com/angular-ui/ui -calendar/issues/267

       scope.initCalendar = function () {
                if (!calendar) {
                    calendar = $(elm);
                }
                calendar.fullCalendar(options);
                if (attrs.calendar) {
                    uiCalendarConfig.calendars[attrs.calendar] = calendar;
                }
         };

但是似乎此修复程序不适用于流星和角流星.

But is seems this fix doesnt work with meteor and angular-meteor.

关于如何解决此问题的任何想法?

Any ideas on how to fix this issue?

推荐答案

问题是angular在window中找不到jquery.$

the problem is that angular doesn't find jquery in window.$

如果您使用的是es6模块:

if you are using es6 modules:

import jquery from "jquery";

export default (window.$ = window.jQuery = jquery);

否则,您应该在index.html中和应用程序代码之前添加js脚本:

otherwise you should add js script in you index.html and before your app code:

window.$ = window.jQuery = jquery

这篇关于Angular UI-Calendar TypeError:calendar.fullCalendar不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆