I need to communicate state which several services need and originates in data bound to the scope of a controller. What would a good and \'Angular zen\' way to
You have two options:
$watch
. I.e. what you implemented, or put differently the Mediator Pattern.$scope.$broadcast
and/or $scope.$emit
with $scope.$on
events to communicate changes.Personally I don't see anything wrong with option (1). I also don't consider that to be global state in the traditional sense. Your configuration is contained within the Configuration
service, you can only access this service through DI injection which makes it testable.
One possible improvement is to create a ConfigMediator service and move the update and callback functionality to it to separate concerns.