angular-cn/public/docs/js/latest/api/http/XHRBackend-class.jade
2015-07-30 11:19:45 -07:00

74 lines
1.5 KiB
Plaintext

p.location-badge.
exported from <a href='../http'>angular2/http</a>
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.32/modules/angular2/src/http/backends/xhr_backend.ts#L62-L96">angular2/src/http/backends/xhr_backend.ts (line 62)</a>
:markdown
Creates <a href='XHRConnection-class.html'><code>XHRConnection</code></a> 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, httpInjectables, BaseRequestOptions} from 'angular2/http';
@Component({
viewInjector: [
httpInjectables,
bind(Http).toFactory((backend, options) => {
return new Http(backend, options);
}, [MyNodeBackend, BaseRequestOptions])]
})
class MyComponent {
constructor(http:Http) {
http('people.json').subscribe(res => this.people = res.json());
}
}
```
.l-main-section
h2 Annotations
.l-sub-section
h3.annotation Injectable
pre.prettyprint
code.
@Injectable()
.l-main-section
h2 Members
.l-sub-section
h3 constructor
pre.prettyprint
code.
constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions)
:markdown
.l-sub-section
h3 createConnection
pre.prettyprint
code.
createConnection(request: Request)
:markdown