I need to share data between two controller (controller A and controller B). I have a service in place to share the data. This works and controllerB can see the value that controllerA sets if I'm setting the value of the shared variable using "ng-model=shared.id" from the view, however; if I set the shared variable inside of the controllerA, then controllerB doesn't see it.
app['controller']('controllerA', ['shared', function(shared){
//ControllerB will not see this for some reason, unless I set
//the value from the view using the ng-model=shared.id attribute.
shared['id'] = "123";
}]);
app['controller']('controllerB', ['shared', function(shared){
this['someId'] = shared['id'];
}]);
this['someId'] = shared['id'];when the shared variable updates.