Sending HTTP GET and PUT Requests with the $http Service
The $http
service enables you to directly interact with the web server from your AngularJS code. The $http
service uses the browser’s XMLHttpRequest
object underneath, but from the context of the AngularJS framework.
There are two ways to use the $http
service. The simplest is to use one of the following built-in shortcut methods that correspond to standard HTTP requests:
■ delete(
url, [
config])
■ get(
url, [
config])
■ head(
url, [
config])
■ jsonp(
url, [
config])
■ post(
url,
data, [
config])
■ put(
url,
data, [
config])
■ patch(
url,
data, [
config])
Configuring the $http Request
In these methods, the url
parameter is the URL of the web request. The optional config
parameter is a JavaScript object ...
Get Learning AngularJS now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.