Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

services won't get called again when changing language #116

Open
pixelatorz opened this issue Nov 5, 2021 · 1 comment
Open

services won't get called again when changing language #116

pixelatorz opened this issue Nov 5, 2021 · 1 comment
Labels
question Further information is requested

Comments

@pixelatorz
Copy link

If I am correct this repo is a fork from the Greentube/localize-router.

We changed the greentube one to this one, everything seems to be working fine, however there seems to be one issue.

When changing the language with the Greentube code the page seems to do a hard refresh and services get called again with the correct language.

When using ngx-translate-router this does not happen, causing the site to translate everything thats loaded through the translation files, but not refreshing the content loaded through services.

Its possible to build a workaround by listening to the language changes and then calling the services again but in a large application thats quite some overhead.

any Idea on how to solve this?

@gilsdav
Copy link
Owner

gilsdav commented Nov 29, 2021

Hello @pixelatorz,

That's correct and this is a wanted feature (do not recreate complete component when it's exactly the same one).

The good way is to use .stream() and not .get() from ngx-translate into your RXJS logics.

Otherwise it's possible to go back to default "reuse component strategy" using this code:

{
      provide: RouteReuseStrategy,
      useClass: DefaultRouteReuseStrategy
 }

@gilsdav gilsdav added the question Further information is requested label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants