Reputation: 83
I am having issues trying to minify my Angular app. The error I am receiving is:
Error: [$injector:unpr] Unknown provider: $scope, dataServiceProvider <- $scope, dataService
My App:
angular.module('Forms', [
'ngRoute',
'Forms.Services',
'Forms.Directives',
'Forms.Controllers'
])
My Service is:
angular.module('Forms.Services', []).
service('dataService', ['$http', function ($http) {
this.getData = function(callback) {
$http.get('forms.json').success(callback);
}
}]);`
My Controller is:
angular.module('Forms.Controllers', []).
controller('FormController', ['$scope, dataService', function ($scope, dataService) {
dataService.getData(function(results) {
$scope.data = results;
});
}])
It is working fine without the Array notation but as you know it will not minify.
Upvotes: 1
Views: 2417
Reputation: 9682
Should be:
controller('FormController', ['$scope', 'dataService', function //...
instead of:
controller('FormController', ['$scope, dataService', function //...
Note that the dependencies are listed as separate strings in the array, not as a single string.
Upvotes: 3