Angular study Notes (23)-$http (1)-api

Source: Internet
Author: User

The $http.get and $http.post mentioned earlier are all based on $http shortcuts. The following is the complete $http:

$http (config)

$http accept a parameter config in JSON format:

The format of config is as follows:

{method: String, URL: String, Params:json object, data: Request data, headers: request header, Transformrequest: function, convert POST request format, Transformrespons E: function, convert the response to the format of the data, cache: Boolean, timeout: value, from the request start calculation, wait for the number of milliseconds, more than this number has not responded, then return error withcredentials: Boolean}

1.method: (Required)

Requested method, string format, ' post ', ' Get ', ' head ', ' delete ', ' put ', ' Jsonp '

(where the head method needs to ask the husband)

2.url: (Required)

Requested path, string format

3.params:

Request with parameters, JSON object:

{key1: ' value1 ', Key2: ' value2 '} // converted into URL? key1=value1&key2=value2

4.data:

The data, string, or JSON object submitted by the POST request

5.headers:

Request headers, JSON objects, parameters that can be customized to configure HTTP request headers

6.transformRequest:

function to convert the format of the POST request data

7.transformResponse:

function that transforms the format of the response to the data

8.cache:

Boolean value, whether to enable caching (temporarily do not understand, need to ask a husband)

9.timeout:

numeric value, the number of milliseconds to wait from the request, and an error is returned if the number is not responding.

10.withCredentials:

Don't understand

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.