ocLazyload 未加载模块

ocLazyload not loading the module

在 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>

我的 app.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"]);
    });
})();

Reference

我也遇到了这个错误,尽管我没有任何拼写错误并且我遵循了 https://oclazyload.readme.io/docs 中的配置说明。我在 Rails 上的 Ruby 中使用 Angular,我的错误通过将下面的行添加到我的 app/assets/javascripts/application.js 得到修复文件:

//= require oclazyload