Angular JS $ http.success () vs $ q.resolve ()?
$http
uses it myself $q
. These services do not work at the same level.
$http.get(url)
returns a promise that can be resolved or rejected. This means that you are using the promise provided by the service ($ http). Inside $http
will call $q.defer()
, then $q.resolve()
or $q.reject()
. This will either call your method .success()
or .fail()
.
$q
is a service for creating your own promise.
Using $q
is a great way to learn about promises, but in your case $http
already does the job for you.
source to share