how can i get the $scope variables in app.factory ????
app.factory('ws', function ($http) {
console.log($scope.variable);
})
I am getting error $scope is not defined
how can i get the $scope variables in app.factory ????
app.factory('ws', function ($http) {
console.log($scope.variable);
})
I am getting error $scope is not defined
"Services are singletons, and it is not logical for a scope to be injected in service (which is case indeed, you cannot inject scope in service). You can pass scope as a parameter, but that is also a bad design choice, because you would have scope being edited in multiple places, making it hard for debugging. Code for dealing with scope variables should go in controller, and service calls go to the service."