I know that for minimization and obfuscation purposes, we should always use the $ injector (via controllerName.$inject = ['$service', '$service2'] ) to indicate the actual names of the services that are required.
If I write a custom service that relies on other services, can I do the same? The only examples I can find to use the method. $ Injection, called on controllers.
If i do
myModule.factory('myService', function($rootScope, anotherService) { return { foo: 'bar' });
Should I add this?
myService.$inject = ['$rootScope', 'anotherService'];
Or perhaps this applies to the module as a whole?
myModule.$inject = ['$rootScope', 'anotherService'];
... But perhaps in this case the module is already tracking its services, and therefore minimization is not a concern?
source share