So, I have a $scope variable defined like this:
$scope.data = { filter: { state: 'WA', country: 'US' } };
How do I access this in a separate service line by line? e.g. data.filter in the context of $scope .
So, say I have a service method:
function doSomething($scope, variableName) {
I would call it from the controller as follows:
service.doSomething($scope, 'data.filter');
source share