Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

angularjs

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

like image 428
yar1 Avatar asked Apr 09 '13 08:04

yar1


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.

like image 168
manojlds Avatar answered Oct 10 '22 05:10

manojlds


$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

like image 44
Tim Hong Avatar answered Oct 10 '22 04:10

Tim Hong