AngularJs: $http Synchronous call
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 till I get the result)? Willem