javascript - Is it bad practice to pass $scope to a service? -


is bad practice pass $scope service? cause memory leaks since controllers can instantiated multiple times?

example:

.controller('testcontroller', function ($scope, testservice) {      $scope.loaddata = function() {         // loaddata set properties on scope         testservice.loaddata($scope);     };  }); 

not sure memory leak part since $scope being placed on stack, yeah, want separate concerns , return data services, not bind data controller within them.

also, can lead confusion if else looking @ controller code , can't figure out how field within $scope got set.


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -