When I\'m loading the minified (through UglifyJS) version of my AngularJS application, I get the following error in the console:
Unknown provider: aProvider
Also do not forget the resolve
property of the route. It also must be defined as the array:
$routeProvider.when('/foo', {
resolve: {
bar: ['myService1', function(myService1) {
return myService1.getThis();
}],
baz: ['myService2', function(myService2) {
return myService2.getThat();
}]
}
});
With generator-gulp-angular:
/** @ngInject */
function SomeController($scope, myCoolService) {
}
Write /** @ngInject */ before each controller, service, directive.
Oliver Salzburg's write-up was fantastic. Upvoted.
Tip for anyone who might have this error. Mine was simply caused by forgetting to pass in an array for a directive controller:
return {
restrict: "E",
scope: {
},
controller: ExampleDirectiveController,
templateUrl: "template/url/here.html"
};
return {
restrict: "E",
scope: {
},
controller: ["$scope", ExampleDirectiveController],
templateUrl: "template/url/here.html"
};