ngx-translate / http-loader

A loader for ngx-translate that loads translations with http calls
MIT License
191 stars 69 forks source link

ngx-translate access other baseurl #56

Closed pbkh-bunthai closed 6 years ago

pbkh-bunthai commented 6 years ago

I use this url to load my Login Ui: http://localhost:5000/login. But in console, it printed error: http://localhost:8081/api/assets/i18n/ja.json 401 (Unauthorized). It access to my api url. It should be access this url http://localhost:5000/assets/i18n/ja.json instead. I do a simple configuration.

export function createTranslateLoader(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

I found this configuration in my project:

{
  "bffBaseUrl": "http://localhost:8081"
}

How can I make it access to http://localhost:5000/assets/i18n/ja.json ?

aicokleinovink commented 5 years ago

I run into the same problem, what was your solution here??

pbkh-bunthai commented 5 years ago

@aicokleinovink

I used this way, it's working fine:

export function createTranslateLoader(http: HttpClient) {
  return new TranslateHttpLoader(http, window.location.origin + '/assets/i18n/json/', '.json');
}

I hope it work for you! :)