$http services
In web technologies, the best way to interact with any web service is through Ajax requests. As Ionic Framework is a Hybrid Mobile framework based on web technologies, it utilizes the power of Ajax to wire up Ionic Apps with any web services.
$http
is an in-built Angular service that is used as an abstraction for native JavaScript Ajax calls. The $http
service has some high-level methods exposed to make HTTP requests using different HTTP methods such as POST
, GET
, PUT
, and so on.
There are different signatures for different methods, but the response for all the methods is exactly the same. All the methods in the $http
service are based on the promise
objects, which help in registering success and error callbacks that receive data at a later point in time as these requests are asynchronous in nature.
The two most important methods are .get
and .post
whose usage is as follows:
$http.get('/api/url/resource') .then(function(response){ // this is success callback },function(errorResponse...