The difference between $http and $resource

In the previous sections, we implemented $http and $resource. In this section, we will discuss the differences between $http and $resource of the AngularJS framework. This table shows the difference between the two approaches:

$http

$resource

$http is for universal purpose. It is an Ajax call.

$resource warps $http for use in RESTful web APIs.

$http is built into the AngularJS framework.

$resource needs to add the module separately.

$http is good for quick retrieval.

$resource is good for conditions slightly more complex than $http.

$http is injected directly into an AngularJS controller by the developer.

$resource does not allow us to do much with data once it is consumed in the application. It is in the final state when it is delivered to the HTML DOM. The data is the same that the $http method will receive.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset