localize-router-http-loader
A loader for localize-router that loads config using Http
This package is built for angular version <4.3
Installation
npm install --save localize-router-http-loader
Usage
In order to load localize-router
config via http, you must initialize LocalizeRouterModule with LocalizeRouterHttpLoader:
export function HttpLoaderFactory(translate: TranslateService, location: Location, settings: LocalizeRouterSettings, http: Http) {
return new LocalizeRouterHttpLoader(translate, location, settings, http);
}
LocalizeRouterModule.forRoot(routes, {
parser: {
provide: LocalizeParser,
useFactory: (translate, location, settings, http) =>
new HttpLoaderFactory,
deps: [TranslateService, Location, LocalizeRouterSettings, Http]
}
})
Parameters
LocalizeRouterHttpLoader
has one optional parameter path
which points to json config file. Default value is assets/locales.json
.
export function HttpLoaderFactory(translate: TranslateService, location: Location, settings: LocalizeRouterSettings, http: Http) {
return new LocalizeRouterHttpLoader(translate, location, settings, http, 'my/custom/url/to/file.json');
}
License
Licensed under MIT