ngCookies不加载

时间:2015-08-17 10:12:23

标签: angularjs

我有以下问题。

这是我的角度应用程序定义:

angular.module('app', [
    'ui.router',
    'ui.utils',
    'ngCookies',
    'oc.lazyLoad'
]);

这是我的主要html文件的一部分:

<!-- ANGULAR -->
<script src="assets/plugins/angular/angular.js" type="text/javascript"></script>
<script src="assets/plugins/angular-ui-router/angular-ui-router.min.js" type="text/javascript"></script>
<script src="assets/plugins/angular-ui-util/ui-utils.min.js" type="text/javascript"></script>
<script src="assets/plugins/angular-sanitize/angular-sanitize.min.js" type="text/javascript"></script>
<script src="assets/plugins/angular-oc-lazyload/ocLazyLoad.min.js" type="text/javascript"></script>

<!--ngCookies-->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular-cookies.js" type="text/javascript"></script>

所以我认为我已经完成了使用$cookieStore所需的全部工作。然而,当我运行我的应用程序时,我看到一个空白的浏览器窗口,并在控制台中:

Error: [$injector:modulerr] Failed to instantiate module app due to:
[$injector:modulerr] Failed to instantiate module ngCookies due to:
[$injector:nomod] Module 'ngCookies' 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.
http://errors.angularjs.org/1.3.15/$injector/nomod?p0=ngCookies
minErr/<@file:///D:/Webstorm/Magic/assets/plugins/angular/angular.js:63:12
module/<@file:///D:/Webstorm/Magic/assets/plugins/angular/angular.js:1774:1
ensure@file:///D:/Webstorm/Magic/assets/plugins/angular/angular.js:1698:38
module@file:///D:/Webstorm/Magic/assets/plugins/angular/angular.js:1772:1
loadModules/<@file:///D:/Webstorm/Magic/assets/plugins/angular/angular.js:4115:22
forEach@file:///D:/Webstorm/Magic/assets/plugins/angular/angular.js:323:11
loadModules@file:///D:/Webstorm/Magic/assets/plugins/angular/angular.js:4099:5
loadModules/<@file:///D:/Webstorm/Magic/assets/plugins/angu

谁能告诉我,我忘了做什么?

1 个答案:

答案 0 :(得分:1)

你可以尝试的事情:

  1. 将http://添加到src

  2. 尝试使用bower下载,然后将其添加为其余部分