即使使用ng-annotate,在grunt构建之后Angular模块也不可用

时间:2016-06-01 10:24:31

标签: angularjs gruntjs yeoman ng-annotate

我正在使用Yeoman角度的genarator。我创建了Angular模块,然后尝试将其加载到应用程序中。 Grunt正在使用ng-annotate,供应商脚本(模块所在)在app脚本之前加载,所以我不知道问题是什么。

这是令人印象深刻的index.html

<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> <link rel="stylesheet" href="styles/vendor.20fdc362.css"> <link rel="stylesheet" href="styles/main.16c86e60.css"> </head> <body ng-app="strauiApp"> <!--[if lte IE 8]>
  <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]--> <div ui-view></div> <script src="scripts/vendor.c9b57eb5.js"></script> <script src="scripts/scripts.7ce0b4a1.js"></script> </body> </html>

这是注册模块的供应商文件的一部分

function(){"use strict";angular.module("streamlineCore",["configs","ngResource","ui.router","ngMessages","toastr","angular-loading-bar","ipCookie"]).config ...

这是脚本文件的开始

!function(){"use strict";angular.module("strauiApp",["streamlineCore","ui.bootstrap"])}(),

错误是

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

这里有什么不对?缺少什么?

2 个答案:

答案 0 :(得分:0)

您确定在strauiApp模块之前的scripts / scripts.7ce0b4a1.js中插入了streamlineCore模块吗?

答案 1 :(得分:0)

导致问题的是bootstrap js。这个js由grunt-wiredep自动添加。