0

Now I am working on a project using Asp.Net MVC + AngularJS. Everything go well in development, but when I run it on IIS, an error occurs:

Uncaught Error: [$injector:unpr] Unknown provider: nProvider <- n

How can I locate the nProvider? How can I fix this error?

Screenshots of my errors:

Console output

Javascript source

purezhi
  • 5
  • 3

2 Answers2

0

try reading the answer to this post and see if it helps you.

You should be able to see the component's name in the function hopefully. a bit poor but better than nothing. let's hope angular 2.0 is a little more helpful.

Finding the cause of "Unknown provider" errors

Community
  • 1
  • 1
0

Thanks above all. It's really a minification problem. I'v found the solution, please refer the following codes, the italic codes are added to fix the problem.

Change

var app = angular.module('app', [
    'ui.router',
    '...'
])
.run(function ($templateCache, $http) {
    $http.get('tpl.path')
        .then(function(response) {
            // ...
        });
});

To

var app = angular.module('app', [
    'ui.router',
    '...'
])
.run(['$templateCache', '$http', function ($templateCache, $http) {
    $http.get('tpl.path')
        .then(function(response) {
            // ...
        });
}]);
purezhi
  • 5
  • 3