In most angularjs tutorials I've seen promise chains result in changing a scope variable.
$http.get(someURL).then(function (value) {
$scope.someValue = value;
});
Is it possible to return that value to a parent function? Ever method I've tried just returns another promise.
$scope.test = function(){
return $http.get(someURL).then(function (value) {
return value;
});
};
$scope.test = function(){
var deferred = $q.defer();
$http.get(someURL).then(function (value) {
deferred.resolve(value);
});
return deferred.promise;
}
I don't want to chain another promise, just return the json so I can do something like this:
<button ng-click='some_vars = test()'>Get ajax</button>
<ul ng-repeat='var in some_vars'>
<li>{{var.title}}</li>
</ul>
$parseProvider, like this:$parseProvider.unwrapPromises(true);