Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.

Use relative path so that we properly apply --base-href. #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/ngx-translate/http-loader/src/lib/http-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {TranslateLoader} from "@ngx-translate/core";
import {Observable} from 'rxjs';

export class TranslateHttpLoader implements TranslateLoader {
constructor(private http: HttpClient, public prefix: string = "/assets/i18n/", public suffix: string = ".json") {}
constructor(private http: HttpClient, public prefix: string = "./assets/i18n/", public suffix: string = ".json") {}

/**
* Gets the translations from the server
Expand Down
8 changes: 4 additions & 4 deletions projects/ngx-translate/http-loader/tests/http-loader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('TranslateLoader', () => {
});

// mock response after the xhr request, otherwise it will be undefined
http.expectOne('/assets/i18n/en.json').flush({
http.expectOne('./assets/i18n/en.json').flush({
"TEST": "This is a test",
"TEST2": "This is another test"
});
Expand All @@ -69,11 +69,11 @@ describe('TranslateLoader', () => {
expect(translate.instant('TEST')).toEqual('This is a test 2');
});

http.expectOne('/assets/i18n/en.json').flush({"TEST": "This is a test 2"});
http.expectOne('./assets/i18n/en.json').flush({"TEST": "This is a test 2"});
});

// mock response after the xhr request, otherwise it will be undefined
http.expectOne('/assets/i18n/en.json').flush({"TEST": "This is a test"});
http.expectOne('./assets/i18n/en.json').flush({"TEST": "This is a test"});
});

it('should be able to reset a lang', (done: Function) => {
Expand Down Expand Up @@ -101,6 +101,6 @@ describe('TranslateLoader', () => {
});

// mock response after the xhr request, otherwise it will be undefined
http.expectOne('/assets/i18n/en.json').flush({"TEST": "This is a test"});
http.expectOne('./assets/i18n/en.json').flush({"TEST": "This is a test"});
});
});