Vote count:
0
I have a service to for api call as following,
getValue: function(input) {
var deferred, url;
deferred = $q.defer();
url = "url";
$http.post(url, input).success(function(data, status, headers, config) {
return deferred.resolve({
success: true,
data: data,
status: status,
headers: headers,
config: config
});
}).error(function(data, status, headers, config) {
return deferred.resolve({
success: false,
data: data,
status: status,
headers: headers,
config: config
});
});
return deferred.promise;
}
But this is async. How can i convert it to sync? (I want to make it wait til i get the result)
Please help, Thanks
asked 30 secs ago
AngularJs: $http Synchronous call
Aucun commentaire:
Enregistrer un commentaire