Commits
William Welling authored 600fbc6df7c
1 1 | import { HttpClient } from '@angular/common/http'; |
2 2 | import { TranslateLoader } from '@ngx-translate/core'; |
3 3 | import { map } from 'rxjs/operators'; |
4 - | import JSON5 from 'json5'; |
4 + | import * as JSON5 from 'json5'; |
5 5 | |
6 6 | export class TranslateJson5HttpLoader implements TranslateLoader { |
7 7 | constructor(private http: HttpClient, public prefix?: string, public suffix?: string) { |
8 8 | } |
9 9 | |
10 10 | getTranslation(lang: string): any { |
11 11 | return this.http.get('' + this.prefix + lang + this.suffix, {responseType: 'text'}).pipe( |
12 12 | map((json: any) => JSON5.parse(json)) |
13 13 | ); |
14 14 | } |
15 15 | } |