2016-06-01 30 views
1

我正在使用Yeoman角度變形器。我創建了Angular模塊,並嘗試將它加載到應用程序中。 Grunt使用ng-annotate,供應商腳本(模塊在哪裏)在應用程序腳本之前加載,所以我不知道有什麼問題。即使使用ng-annotate也不能使用Angular模塊

這commpressed的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 ... 

廠商文件的一部分,這是beggining腳本文件

!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. 

這裏有什麼問題?少了什麼東西?

回答

0

您確定streamlineCore模塊插入到strauiApp模塊之前的scripts/scripts.7ce0b4a1.js中嗎?

+0

它被插入到供應商文件中。 –

+0

當我將模塊移動到腳本文件時,它看起來已加載,但現在我收到「Failed to instantiate module ngResource」錯誤。所以看起來來自供應商文件的所有模塊都無法加載。 –

+0

文件中模塊的順序很重要。確保在依賴模塊之前加載每個模塊的依賴關係。 – frane

0

這是導致問題的引導js。這個js是由grunt-wiredep自動添加的。

相關問題