Communicating with RESTful endpoints

The Representational State Transfer (REST) is a popular architectural choice for exposing services over a network. The interface provided by $http allows us to easily interact with RESTful endpoints from any AngularJS-based web application. But AngularJS goes one step further, and provides a dedicated $resource service to make interactions with RESTful endpoints even easier.

The $resource service

RESTful endpoints often expose CRUD operations that are accessible by calling different HTTP methods on a set of similar URLs. The code that interacts witch such endpoints is usually straightforward but tedious to write. The $resource service allows us to eliminate the repetitive code. We can also start to operate on ...

Get Mastering Web Application Development with AngularJS now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.