Jsonp

已弃用: see https://angular.io/guide/http

class Jsonp extends Http { request(url: string | Request, options?: RequestOptionsArgs): Observable<Response> // 继承自 http/Http protected _backend: ConnectionBackend protected _defaultOptions: RequestOptions request(url: string | Request, options?: RequestOptionsArgs): Observable<Response> get(url: string, options?: RequestOptionsArgs): Observable<Response> post(url: string, body: any, options?: RequestOptionsArgs): Observable<Response> put(url: string, body: any, options?: RequestOptionsArgs): Observable<Response> delete(url: string, options?: RequestOptionsArgs): Observable<Response> patch(url: string, body: any, options?: RequestOptionsArgs): Observable<Response> head(url: string, options?: RequestOptionsArgs): Observable<Response> options(url: string, options?: RequestOptionsArgs): Observable<Response> }
      
      class Jsonp extends Http {
  request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>

  // 继承自 http/Http
  protected _backend: ConnectionBackend
  protected _defaultOptions: RequestOptions
  request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>
  get(url: string, options?: RequestOptionsArgs): Observable<Response>
  post(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>
  put(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>
  delete(url: string, options?: RequestOptionsArgs): Observable<Response>
  patch(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>
  head(url: string, options?: RequestOptionsArgs): Observable<Response>
  options(url: string, options?: RequestOptionsArgs): Observable<Response>
}
    

方法

Performs any type of http request. First argument is required, and can either be a url or a Requestinstance. If the first argument is a url, an optional RequestOptionsobject can be provided as the 2nd argument. The options object will be merged with the values of BaseRequestOptionsbefore performing the request.

request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>
      
      request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>
    
参数
url string | Request
options RequestOptionsArgs

可选. 默认值是 undefined.

返回值

Observable<Response>