JSFiddle - React, Tailwind, and code Playground
by jhoguet
HTML
<h1>Showing Module Dependency Hell</h1>
<h2>Can two different modules, use same but independent id?</h2>
<h3> a > aa (stringFormatter); b > bb (stringFormatter)</h3>
<div ng-app="ServiceTestApp">
<div ng-controller="ServiceTestController" >
<p>{{aFormatted}}</p>
<p>{{bFormatted}}</p>
</div>
</div>
JavaScript
var app = angular.module('ServiceTestApp', ['a','b'])
.controller('ServiceTestController', function ($scope,aService, bService) {
$scope.aFormatted = aService('');
$scope.bFormatted = bService('');
});
var a = angular.module('a',['aa'])
.service('aService', function(stringFormatter){
return stringFormatter;
});
var aa = angular.module('aa',[])
.service('stringFormatter', function(){
return function(){ return arguments[0] + 'aa was here.';};
});
var b = angular.module('b',['bb'])
.service('bService', function(stringFormatter){
return stringFormatter;
});
var bb = angular.module('bb',[])
.service('stringFormatter', function(){
return function(){ return arguments[0] + 'bb was here.';};
});