10

I need to better understand the difference between $http and $resource and when to use each

2
  • 1
    I 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... Commented Apr 9, 2013 at 9:00
  • 3
    possible duplicate of AngularJS $http and $resource Commented Jul 29, 2014 at 18:49

2 Answers 2

9

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.

Sign up to request clarification or add additional context in comments.

Comments

3

$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

AngularJS $http and $resource

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.