I need to better understand the difference between $http and $resource and when to use each
-
1I know that basically $http is a wrapper for xmlHTTPRequest (aka AJAX) like jQuery's $ajax and that $resource is supposed to be more REST-specific but I don't really get how...yar1– yar12013-04-09 09:00:02 +00:00Commented Apr 9, 2013 at 9:00
-
3possible duplicate of AngularJS $http and $resourceMax– Max2014-07-29 18:49:46 +00:00Commented Jul 29, 2014 at 18:49
Add a comment
|
2 Answers
From the $resource docs:
A factory which creates a resource object that lets you interact with RESTful server-side data sources.
The returned resource object has action methods which provide high-level behaviors without the need to interact with the low level $http service.
$resource is a higher level service than $http.
Comments
$resource is built on top of $http.
$http is normal ajax, it can be used for any form of web service.
$resource is specifically for RESTful service.
More details on this