How can I use scope change event in services in angularJs -


I have a controller and a service, but now I want my controller code to be moved to the services so that it is again : Can be made usable. But the problem I am experiencing here is that my controller is using the $ scope service, which means that my code is dependent on the $ diameter event. If I move my code into service, then how can I change this $ scope event now?

I do not know that this is the most effective way, but you pass the $ radius as the function parameter can do.

Controller:

  MyService.aMethod ($ scope, other parameters);  

Service:

  this.aMethod = function (scope, other parameters) {scope.result = otherParameter * 10; }  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -