I have been working on angular and today I have the need to modify a scope value from a javascript function, however I have not found an efficient way to do it from outside the controler, Does anyone know how it could be done?
I have been working on angular and today I have the need to modify a scope value from a javascript function, however I have not found an efficient way to do it from outside the controler, Does anyone know how it could be done?
If you need to be modifying a variable globally (different controllers) stop using $scope
since its scope is in a single controller. I recommend you use $rootScope
since the scope of the variables declared here is greater and you can access them from any controller.
You will have to inject in all controls $rootScope
.