I\'ve been trying to use the answer here posted by Mark Rajcok
angular JS - communicate between non-dependend services
I am having trouble understanding his answ
In his example, NotificationService
is a new service that any of the existing services would depend on. He provided an implementation of Service1
but Service2
would essentially be the same...both depend on NotificationService
and neither know about each other.
Service1
and Service2
each subscribe to events by calling NotificationService.onEvent1(event1Happened);
and trigger events by calling NotificationService.event1Happened(my_data);
.