Note: You can also use .post, .put, .delete, .jsonp, .head or .patch
There is another complexer but completer syntax:
$http({
method: 'GET',
url: '/someUrl'
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
AJAX (Asynchronous JavaScript And XML) is the method you can get and send data to a remote server, and make your angular app 100% dynamic.
This happen by using HTTP(s). HTTP is a comunication protocol. It implements some methods for the different actions you want to do:
$http
Angular has a service called
$http
. Full documentation.To use it, is as easy as injecting $http in your service, controller or directive, and:
Note: You can also use
.post
,.put
,.delete
,.jsonp
,.head
or.patch
There is another complexer but completer syntax:
(Full documentation about this way in https://docs.angularjs.org/api/ng/service/$http#usage)