【问题标题】:Kendo AngularJS module fails to load in custom Ektron widgetKendo AngularJS 模块无法在自定义 Ektron 小部件中加载
【发布时间】:2014-10-21 12:37:53
【问题描述】:

我在尝试在自定义 Ektron 小部件中加载 AngularJS 模块时遇到问题。 app.js 文件开头为:

var app = angular.module('myApp', ['ngAnimate', 'ngRoute', 'kendo.directives', 'chieffancypants.loadingBar']);

我看到的错误是:

Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module kendo.directives due to:
Error: [$injector:nomod] Module 'kendo.directives' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

现在,我很确定我没有拼错它,并且 Kendo JavaScript 文件已加载,所以不确定发生了什么。就像最好的问题一样,它是间歇性的,它只在某些页面上发生,而且只是在某些时候发生,而且我在受影响的页面或它发生的时间中都看不到任何模式。

这是脚本文件:

<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="/Includes/js/kendo/angular.js"></script>
<script type="text/javascript" src="/Includes/js/kendo/angular-animate.js"></script>
<script type="text/javascript" src="/Includes/js/kendo/angular-route.js"></script>
<script type="text/javascript" src="/Includes/js/kendo/kendo.all.min.js"></script>
<script type="text/javascript" src="/Includes/js/loading-bar.min.js"></script>
<script type="text/javascript" src="/Includes/js/app.js"></script>

干杯, 斯图尔特。

【问题讨论】:

    标签: javascript angularjs kendo-ui ektron


    【解决方案1】:

    Ektron 也可能正在加载它自己的 jQuery 库文件。我会检查页面的 HTML 源代码,看看您是否加载了超过 1 个 jQuery 库。发生这种情况时,它通常会破坏页面上的大部分 Javascript。

    还值得检查 Chrome 控制台或 Firefox 的 Web Developer 工具栏插件以查看引发了哪些 Javascript 错误。您可能会在 Javascript 中遇到早期错误,这会在此处产生连锁反应。

    【讨论】:

    • Ektron 绝对会加载它自己的 jQuery 库,尽管我们确信如果我们想使用另一个版本它不应该发生冲突。到目前为止还没有。
    • Chrome 或 Firefox 控制台中没有记录其他错误。
    猜你喜欢
    • 1970-01-01
    • 2012-09-16
    • 2015-02-09
    • 2012-10-10
    • 1970-01-01
    • 2012-08-25
    • 2013-06-03
    • 2015-07-27
    • 1970-01-01
    相关资源
    最近更新 更多