is there any possibility to detect the completion of HTTP request in angular1 ?
product factory :
app
.factory('productFactory', ['$http','config',
function($http,config) {
var url = config.domainBase +':'+config.domainPort +config.additionalPath+'/Product/All'
return {
getAll: function() {
return $http.get(url);
}
};
}
]);
var req = productFactory.getAllServers();
req.success(function(response) {
//....
}).
error(function(error){
//error
});
Take a look at $q injector
var deferred = $q.defer();
var params = {
...
};
$http.post('http://www.example.com', JSON.stringify(params))
.success(function(object) {
// On success
})
.error(function(object, status) {
// On error
});
return deferred.promise;