Lucas - I use $watch in that way. As an example I need to switch the
layout of UI based on widow width so in my general app controller (not
tied to a view) I have have a function checks window.resize event and
sets $scope.windowWidth. I then use $scope.$watch('windowWidth', ...)
in the views that need to adjust (that is just done by CSS).
I did not think of same approach for cross controller communication in
general - I guess concerned about too many watchers but not for any
So is this a 4th approach to cross controller communication aka
"wiring up the app":
1. Shared service
3. Prudent pragmatic use of $root scope
And a 5th - scope prototypical inheritance?
On Tue, Jun 19, 2012 at 10:23 AM, Lukas Ruebbelke <sim...@gmail.com
> I definitely recommend using a shared service to communicate between
> If you look at my fiddle, I use $rootScope as an event bus just to broadcast
> an event so that the other controllers know that something has changed.
> Although! I was told you could do that in the controller itself via $watch.
> I need to look into that...
> Also, I am injecting $rootScope and not breaking law of demeter by reaching
> too far into $scope to get it ie: $scope.$root.someValue.
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To view this discussion on the web visit