From 477e425f57d06116e778c730486d4e7ad87ffb4b Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Thu, 18 Aug 2016 15:01:07 -0700 Subject: [PATCH] fix(http): inline HTTP_PROVIDERS and JSONP_PROVIDERS until the metadata collector can do it automatically. (#10928) --- modules/@angular/http/http.ts | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/modules/@angular/http/http.ts b/modules/@angular/http/http.ts index 006ebf6c84..bc77731c94 100644 --- a/modules/@angular/http/http.ts +++ b/modules/@angular/http/http.ts @@ -84,7 +84,19 @@ export function jsonpFactory(jsonpBackend: JSONPBackend, requestOptions: Request * * @experimental */ -@NgModule({providers: HTTP_PROVIDERS}) +@NgModule({ + // TODO(alxhub): switch back to HTTP_PROVIDERS when the metadata collector can inline it + providers: [ + // TODO(pascal): use factory type annotations once supported in DI + // issue: https://github.com/angular/angular/issues/3183 + {provide: Http, useFactory: httpFactory, deps: [XHRBackend, RequestOptions]}, + BrowserXhr, + {provide: RequestOptions, useClass: BaseRequestOptions}, + {provide: ResponseOptions, useClass: BaseResponseOptions}, + XHRBackend, + {provide: XSRFStrategy, useFactory: _createDefaultCookieXSRFStrategy}, + ], +}) export class HttpModule { } @@ -93,6 +105,17 @@ export class HttpModule { * * @experimental */ -@NgModule({providers: JSONP_PROVIDERS}) +@NgModule({ + // TODO(alxhub): switch back to JSONP_PROVIDERS when the metadata collector can inline it + providers: [ + // TODO(pascal): use factory type annotations once supported in DI + // issue: https://github.com/angular/angular/issues/3183 + {provide: Jsonp, useFactory: jsonpFactory, deps: [JSONPBackend, RequestOptions]}, + BrowserJsonp, + {provide: RequestOptions, useClass: BaseRequestOptions}, + {provide: ResponseOptions, useClass: BaseResponseOptions}, + {provide: JSONPBackend, useClass: JSONPBackend_}, + ], +}) export class JsonpModule { }