Last active
July 4, 2016 20:14
-
-
Save ronapelbaum/9e1c65794612c12924b603aec947f4e4 to your computer and use it in GitHub Desktop.
angular Circular Dependency
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module("app", []) | |
.service('A', function(B) { | |
this.data1 = 'a'; | |
this.foo = function() { | |
console.log('A.foo:', this.data1, B.data2); | |
} | |
}) | |
.service('B', function(A) { | |
this.data2 = 'b'; | |
this.foo = function() { | |
console.log('B.foo:', A.data1, this.data2); | |
} | |
}) | |
.run(function(A, B) { | |
A.foo(); | |
B.foo(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment