yar1
yar1

Reputation: 1351

Angular js: what is the difference between $http and $resource

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

Upvotes: 10

Views: 10951

Answers (2)

Tim Hong
Tim Hong

Reputation: 2764

$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

Upvotes: 3

manojlds
manojlds

Reputation: 301117

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.

Upvotes: 9

Related Questions