forked from DarkXaHTeP/angular-progress-http
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogress-http.module.ts
More file actions
32 lines (29 loc) · 1.13 KB
/
Copy pathprogress-http.module.ts
File metadata and controls
32 lines (29 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {NgModule } from '@angular/core';
import { RequestOptions, XHRBackend } from "@angular/http";
import { HttpFactory } from "./interfaces";
import { ProgressBrowserXhrFactory } from "./xhr/ProgressBrowserXhrFactory";
import { XHRBackendFactory } from "./xhr/XHRBackendFactory";
import { HTTP_FACTORY } from "./http-factory.token";
import { AngularHttpFactory } from "./AngularHttpFactory";
import { ProgressHttp } from "./progress-http.service";
export function progressHttpFactory(
xhrBackendFactory: XHRBackendFactory,
requestOptions: RequestOptions,
httpFactory: HttpFactory
): ProgressHttp {
const backend = xhrBackendFactory.create(null, null);
return new ProgressHttp(xhrBackendFactory, requestOptions, httpFactory, backend);
}
@NgModule({
providers: [
ProgressBrowserXhrFactory,
XHRBackendFactory,
AngularHttpFactory,
{ provide: HTTP_FACTORY, useExisting: AngularHttpFactory },
{
provide: ProgressHttp,
useFactory: progressHttpFactory,
deps: [XHRBackendFactory, RequestOptions, HTTP_FACTORY]},
]
})
export class ProgressHttpModule {}