An object $qin Angular allows us to define a promise and handle the behavior associated with the promise. An example of how we can do this:
var q = $q.defer()
if(success){
q.resolve()
} else {
q.reject()
}
return q
, q. , , . .resolve() , . .reject() , .
, :
SomeFactory.getSomething().then(function(data){
}, function(error){
}
, , , , 500, , , .
responseError , . $q.reject(response), . - ( , ), , .
:
1- , , .
2- Angular , .