Any client-server interaction typically boils down to sending HTTP requests to a server and receiving responses from a server. For heavy apps of JavaScript, we depend on the AJAX request/response mechanism to communicate with the server. To support AJAX-based communication, AngularJS exposes two framework services:
$http
: This is the primary component to interact with a remote server using AJAX. We can compare it to theajax
function of jQuery as it does something similar.$resource
: This is an abstraction build over$http
to make communication with RESTful (http://en.wikipedia.org/wiki/Representational_state_transfer) services easier.
Before we delve much into the preceding service we need to set up our server platform that stores the data and allows us to manage it.
For data persistence, we use a document database, MongoDB (https://www.mongodb.org/), hosted over MongoLab (https://mongolab.com/) as our data store. The reason...