Angular js App minification

2019-09-18 06:52发布

问题:

Very popular issue:

Unknown provider: nProvider <- n <- $http <- $templateFactory <- $view <- $state

I use MVC Bundling for this.

How to read this message?

Does it mean that $state requires $view that requires $templateFactory etc.?

回答1:

It was a problem in some external directives. So I go through all of them and fixed syntax of service injections:

from

app.service('myService', function($scope, $animate) {});

to

app.service('myService', ['$scope', '$animate', function($scope, $animate) {}]);

To understand where is the problem I have added all scripts to index.html. And then start to minificate scripts with MVC bundle part by part. After this I have found the incorrect for minification script.