ocLazylod未加载模块



在html中,我在app.js-之前加载oclazyload

<!-- inject:js -->
        <script src="/packages/libs/jquery/dist/jquery.js"></script>
        <script src="/packages/libs/angular/angular.js"></script>
        <script src="/packages/libs/oclazyload/dist/ocLazyLoad.js"></script>
        <script src="/packages/libs/angular-ui-router/release/angular-ui-router.js"></script>
        <!-- endinject -->
        <script src="app/app.js" ></script>
        <script src="app/common/app.config.js" charset="utf-8"></script>

我的应用程序.js-

(function () {
    angular.module('app', ['ui.router', 'oc.lazyload']);
    angular.element(document).ready(function () {
        angular.bootstrap(document, ["app"]);
    });
})();

但由于某些原因,它根本没有加载oc.lazyload模块。可能是什么问题?我是不是错过了什么?

Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module oc.lazyload due to:
Error: [$injector:nomod] Module 'oc.lazyload' 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.

有一个打字错误。模块名称为驼色大小写。更改

'oc.lazyload'

'oc.lazyLoad' //'L' capitalized

应将oc-lazyload的依赖项添加为oc.lazyLoad,而不是oc.lazyload

app.js

(function () {
    angular.module('app', ['ui.router', 'oc.lazyLoad']);
    angular.element(document).ready(function () {
        angular.bootstrap(document, ["app"]);
    });
})();

参考

我也有这个错误,尽管我没有任何拼写错误,并且我遵循了https://oclazyload.readme.io/docs.我在RubyonRails中使用Angular,通过在app/assets/javascripts/application.js文件中添加以下行修复了我的错误:

//= require oclazyload

相关内容

  • 没有找到相关文章

最新更新