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
Post a Comment