javascriptangularjsgruntjsgrunt-usemingrunt-contrib-uglify

angular-js uglify downloaded modules


So i have an angular application. With this application i have alot of plugins (modules) that i use in my app.

i am trying to minify them which actually works. However after they have been minified (uglifyed) im getting the following error:

failed to instantiate module app due to:

Due to: And then all the modules. (starting by the first loaded then moving on).

Does this mean that i am unable to minify angular modules. (which would basicly mean im stuck with a 1000 line long HTML file).


Solution

    1. Explicit dependency injection

      app.controller('myController',function(module1,module2){
        //...
      });
      myController.$inject=['module1','module2'];
      
    2. Inline annotation

      app.controller('myController',['module1','module2',function(module1,module2){
        //...
      });