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

subscribe to router event #40

Open
AmitXShukla opened this issue Feb 9, 2018 · 0 comments
Open

subscribe to router event #40

AmitXShukla opened this issue Feb 9, 2018 · 0 comments

Comments

@AmitXShukla
Copy link

I have ngx-translate ChangeLanguage function on navigation (nav is insert on every component), it works fine and translates text as per json in given component.
However, when user routes to another component through [routerLink]=, it forgets about earlier language selection made.
How can I make app remember, earlier language preference?

ngOnInit() {
// subscribe to router event
this.subscription_translate = this.activatedRoute.queryParams.subscribe(
(param: any) => {
let locale = param['locale'];
if (locale !== undefined) {
this._translate.use(locale);
}
});
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant