Skip to main content

Posts

Showing posts from March, 2013

Communicating between controllers in AngularJS

I have seen many solutions to how to make controllers talk to each other whilst at the same time remaining within "da rulez" of writing Angular applications. I have been using Angular for about a month now and at times it has been swearier than a good Haskell session, it is most definitely worth it all in the end. I have written a really nice looking web application for my employer and they seem to like it. I think Angular. One thing I really aced (to my own satisfaction at least) was wrapping a REST (of any type) API using a resource. I will make a separate post about that. Do the simplest thing... Here is my own solution to the problem of how you can make different controllers communicate cleanly using the "event" system that Angular provides. All you have to do is ensure that the following event listener is added to your application root-scope: App.run( function( $rootScope )) { $rootScope.$on('broadcast', function( e, data ) { if (undef