Cancellation will occur depending on the order in which the modules are created. The last module created will take precedence over modules with duplicate services created before it.
SO link regarding service namespace: "Namespacing" services in AngularJS
Plunker: http://plnkr.co/edit/P488AkNtGYGUXmo9gIAT?p=preview
var dep1 = angular.module("dep1",[]); var dep2 = angular.module("dep2",[]); var app = angular.module("app",["dep2","dep1"]); dep1.factory("helloSrvc",function(){ return { msg: "hello from dep1" } }); dep2.factory("helloSrvc",function(){ return { msg: "hello from dep2" } }); app.controller("myCtrl", function(helloSrvc,$scope){ $scope.msg = helloSrvc.msg; }); angular.bootstrap(document,["app"]);
source share