Skip to content

Commit 1ff658d

Browse files
committed
refactor(index): replace Http with HttpClient
1 parent bcaf54a commit 1ff658d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/index.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Http, Response } from '@angular/http';
1+
import { HttpClient } from '@angular/common/http';
22

33
import { Observable } from 'rxjs/Observable';
44
import { TranslateLoader } from '@ngx-translate/core';
@@ -12,7 +12,7 @@ export class TranslatePoHttpLoader implements TranslateLoader {
1212
public domain = '';
1313

1414
constructor(
15-
protected _http: Http,
15+
protected _http: HttpClient,
1616
protected _prefix: string = 'i18n',
1717
protected _suffix: string = '.po'
1818
) {
@@ -25,8 +25,7 @@ export class TranslatePoHttpLoader implements TranslateLoader {
2525
*/
2626
public getTranslation(lang: string): Observable<any> {
2727
return this._http
28-
.get(`${this._prefix}/${lang}${this._suffix}`)
29-
.map((response: Response) => response.text())
28+
.get(`${this._prefix}/${lang}${this._suffix}`, { responseType: 'text' })
3029
.map((contents: string) => this.parse(contents));
3130
}
3231

0 commit comments

Comments
 (0)