A question for angular expert, so I can use a scope in several controllers of a module, I can only with
service(factory) and or
rootScope ? I am in a somewhat bizarre situation. We have a project that the client has a problem in the database, it takes an average of 40 seconds for the bank to present a new data input in the get call. They want me to put the dry dice in the scope of the other controllers, you know, it’s going to cause a lot of problems. Besides the resources and the entity that does the get / post, I’ll have to keep adding the scopes between
controllers, cruds, modulos . There will be a zone, full of ctrl c and ctrl v, someone has any tips for me to get out of this mess, it will be horrible:
service to contain values to be shared.
When one of the controllers needs to change a value, use a service method that locally stores the value and uses
$scope.$broadcast to issue a warning to all controllers that the value has changed.
Within each controller , use
$rootScope.$on to monitor changes and update