AngularJS > $http service

AngularJS > $http service


In this section, we shall learn server call related services in AngularJS that is used to send asynchrnous request to server and receive response.

In AngularJS, communication to the server is done using $http service. As per official website of AngularJS, "the $http service is a core Angular service that facilitates communication with the remote HTTP servers via the browser's XMLHttpRequest object or via JSONP".

The syntax of $http service looks like below

$http({ method: 'METHOD-NAME', url: 'URL' })
.
then(
function successCallback(response) {
// this will be called asynchronously after success
},
function errorCallback(response) {
// called asynchronously if an error occurs
}
);

There are short hand methods for almost all Form methods, that are explained in below posts.

Read posts under AngularJS > $http service

4 posts found
  1. $http.get server request
  2. $http.post server request
  3. $http.put server request
  4. $http.delete server request




Write for us






Hosting Recommendations