1

I am using Yeoman angular genarator. I created Angular module and I try to load it to the app. Grunt is using ng-annotate, vendor scripts (where module is) are loaded before app script, so I don't know what's the problem.

This is 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>

This is part of the vendor file where module is registered

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

And this is beggining of the script file

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

And the error is

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.

What's wrong in here? What's missing?

2 Answers2

0

Are you sure that streamlineCore module is inserted in scripts/scripts.7ce0b4a1.js before strauiApp module?

frane
  • 65
  • 1
  • 7
  • It's inserted in the vendor file. – Kamil Zielinski Jun 01 '16 at 10:53
  • When I moved my module to the scripts file it looks that it's loaded but now I'm receiving "Failed to instantiate module ngResource" error. So it seems like all the modules from the vendor file can't be loaded. – Kamil Zielinski Jun 01 '16 at 11:07
  • Order of modules in file is important. Be sure that dependency for each module is loaded before depended module. – frane Jun 01 '16 at 11:42
0

It was bootstrap js that caused the problem. This js was automatically added by grunt-wiredep.