Can someone crate an example of how I could set a $scope variable from a outside the controller using a factory or service that uses AJAX?
Every time I have tried the AJAX variable returns undefined because the request has not returned yet, so $scope.var
is undefined. After the AJAX request returns, $scope.var
is still undefined even if I call the service from the Controller. Please help.