In this example:
angular.module('myModule', [], function($provide) {
$provide.factory('serviceId', function() {
var shinyNewServiceInstance;
//factory function body that constructs shinyNewServiceInstance
return shinyNewServiceInstance;
});
});
We have a function provided to angular.module()
, that takes $provide
argument.
- If this gets minified, won't it break? If I replace
$provide
with any other argument name ($zprovide
), it can't find the provider. - Neither of these seem to work:
['$provide'], function($zprovide){}
angular.module('myModule', ['$provide'], function($zprovide) {
$zprovide.factory('serviceId', function() {
var shinyNewServiceInstance;
//factory function body that constructs shinyNewServiceInstance
return shinyNewServiceInstance;
});
});
['$provide', function($zprovide){}]
angular.module('myModule', ['$provide', function($zprovide) {
$zprovide.factory('serviceId', function() {
var shinyNewServiceInstance;
//factory function body that constructs shinyNewServiceInstance
return shinyNewServiceInstance;
});
}]);
It appears that the dependency injection system for the angular.module()
function is different from the other services. I can't find any documentation on this.