Модуль Angular недоступен после сборки grunt даже с ng-annotate

Я использую угловой генаратор Yeoman. Я создал модуль Angular и пытаюсь загрузить его в приложение. Grunt использует ng-annotate, скрипты поставщика (где модуль) загружаются до скрипта приложения, поэтому я не знаю, в чем проблема.

Это сжатый 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.

Что здесь не так? Чего не хватает?


person Kamil Zielinski    schedule 01.06.2016    source источник


Ответы (2)


Вы уверены, что модуль streamlineCore вставлен в scripts / scripts.7ce0b4a1.js перед модулем strauiApp?

person frane    schedule 01.06.2016
comment
Он вставлен в файл поставщика. - person Kamil Zielinski; 01.06.2016
comment
Когда я переместил свой модуль в файл сценариев, похоже, что он загружен, но теперь я получаю сообщение об ошибке Failed to instantiate module ngResource. Таким образом, кажется, что все модули из файла поставщика не могут быть загружены. - person Kamil Zielinski; 01.06.2016
comment
Порядок модулей в файле важен. Убедитесь, что зависимость для каждого модуля загружена перед зависимым модулем. - person frane; 01.06.2016

Причиной проблемы был bootstrap js. Этот js был автоматически добавлен grunt-wiredep.

person Kamil Zielinski    schedule 01.06.2016