2015-06-09 18:18:57 -04:00
|
|
|
/**
|
|
|
|
* @module
|
|
|
|
* @public
|
|
|
|
* @description
|
|
|
|
* The http module provides services to perform http requests. To get started, see the {@link Http}
|
|
|
|
* class.
|
|
|
|
*/
|
2015-04-29 02:07:55 -04:00
|
|
|
import {bind, Binding} from 'angular2/di';
|
|
|
|
import {Http, HttpFactory} from './src/http/http';
|
2015-06-09 18:18:57 -04:00
|
|
|
import {XHRBackend, XHRConnection} from 'angular2/src/http/backends/xhr_backend';
|
2015-04-29 02:07:55 -04:00
|
|
|
import {BrowserXHR} from 'angular2/src/http/backends/browser_xhr';
|
2015-06-09 18:18:57 -04:00
|
|
|
import {BaseRequestOptions, RequestOptions} from 'angular2/src/http/base_request_options';
|
2015-04-29 02:07:55 -04:00
|
|
|
|
2015-06-09 18:18:57 -04:00
|
|
|
export {MockConnection, MockBackend} from 'angular2/src/http/backends/mock_backend';
|
|
|
|
export {Request} from 'angular2/src/http/static_request';
|
|
|
|
export {Response} from 'angular2/src/http/static_response';
|
|
|
|
|
|
|
|
export {Http, XHRBackend, XHRConnection, BaseRequestOptions, RequestOptions, HttpFactory};
|
|
|
|
export {IHttp} from 'angular2/src/http/interfaces';
|
|
|
|
export {Headers} from 'angular2/src/http/headers';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides a basic set of injectables to use the {@link Http} service in any application.
|
|
|
|
*
|
|
|
|
* #Example
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* import {httpInjectables, Http} from 'angular2/http';
|
|
|
|
* @Component({selector: 'http-app', appInjector: [httpInjectables]})
|
|
|
|
* @View({template: '{{data}}'})
|
|
|
|
* class MyApp {
|
|
|
|
* constructor(http:Http) {
|
|
|
|
* http.request('data.txt').subscribe(res => this.data = res.text());
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*/
|
2015-04-29 02:07:55 -04:00
|
|
|
export var httpInjectables: List<any> = [
|
2015-06-13 18:49:05 -04:00
|
|
|
bind(BrowserXHR)
|
|
|
|
.toValue(BrowserXHR),
|
2015-04-29 02:07:55 -04:00
|
|
|
XHRBackend,
|
2015-06-13 18:49:05 -04:00
|
|
|
BaseRequestOptions,
|
|
|
|
bind(HttpFactory).toFactory(HttpFactory, [XHRBackend, BaseRequestOptions]),
|
|
|
|
Http
|
2015-04-29 02:07:55 -04:00
|
|
|
];
|