Introducing the ngResource module
In Chapter 7, Introduction to AngularJS, we mentioned the $http
service as means of communication between the AngularJS application and your backend API. While the $http
service provides the developer with a low-level interface for the HTTP request, the AngularJS team figured out they could better help developers when it comes to RESTful APIs. Since the REST architecture is well structured, much of the client code dealing with AJAX requests could be obfuscated using a higher-level interface. For this purpose, the team created the ngResource
module, which provides the developer with an easy way to communicate with a RESTful data source. It does so by presenting a factory, which creates an ngResource
object that ...
Get Web Application Development with MEAN now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.