me

Angular message bus and smart watch

Posted on 5/09/2015

In my Angular apps, I typically add a couple services to $rootScope so they're available to all of my controllers. The first is a message bus for any inter-component messaging, and the other is my replacement for $watch which doesn't fire during registration.

Please note that this code is ES6, so either use an online transpiler or the transpiler of your choice. I would suggest you try Babel if you're not using it already.


No comments:

Post a Comment