Suppose I have a controller that depends on two modules that contain a directive or service with the same name. Can I indicate which one to use?
angular.module('myApp', ['secondModule', 'thirdModule'])
.controller('Ctrl1', ['$scope', 'myService', function(scope, myService){
scope.user = myService.getUser();
console.log(myService);
}]);
In this case, both secondModule and thirdModule have a service named myService . But in this example, only one of the thirdModule will be used . I tried putting something like secondModule.myService as a dependency for Ctrl1 , but this will not work. Is there any namespace in AngularJS?
source
share