$http

  • $http 是一个服务,简单的封装了XMLHttpRequest对象

  • $http(config).success(fun).error(fun)

$http短名方法

  • $http.get()

  • $http.delete()

  • $http.header()

  • $http.jsonp()

  • $http.post()

  • $http.put()

$http 配置对象

  • method

  • url

  • params

  • data

  • headers

  • xsrfHeaderName

  • xsrfCookieName

  • transformRequest

  • transformResponse

  • cache

  • withCredentials

  • timeout

  • responseType

responseType

  • " (string – default)

  • "arraybuffer" (ArrayBuffer)

  • "blob" (blob object)

  • "document" (HTTP document)

  • "json" (JSON object parsed from a JSON string)

  • "text" (string)

  • "moz-blob" (Firefox to receive progress events)

  • "moz-chunked-text" (streaming text)

  • "moz-chunked-arraybuffer" (streaming ArrayBuffer

Last updated