XHRBackend

XHRBackend

Experimental Class

Class Overview

class XHRBackend implements ConnectionBackend {
  constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy)
  
  
  createConnection(request: Request) : XHRConnection
}

Class Description

Creates XHRConnection instances.

This class would typically not be used by end users, but could be overridden if a different backend implementation should be used, such as in a node backend.

Example

import {Http, MyNodeBackend, HTTP_PROVIDERS, BaseRequestOptions} from '@angular/http';
@Component({
  viewProviders: [
    HTTP_PROVIDERS,
    {provide: Http, useFactory: (backend, options) => {
      return new Http(backend, options);
    }, deps: [MyNodeBackend, BaseRequestOptions]}]
})
class MyComponent {
  constructor(http:Http) {
    http.request('people.json').subscribe(res => this.people = res.json());
  }
}

Annotations

@Injectable()

Constructor

constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy)

Class Details

createConnection(request: Request) : XHRConnection

exported from http-index, defined in http/src/backends/xhr_backend.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/docs/ts/latest/api/http/index/XHRBackend-class.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部