1

I want to navigate to the same current url, only changing one query param.

I can't find any info on how to do this:

<a [routerLink]="['./']" [queryParams]="{language: 'fr'}">FR</a>
<a [routerLink]="['./']" [queryParams]="{language: 'nl'}">NL</a>

I also tried with window.location.href but I get an error.

The whole idea is to stay on the same page while switching the language of the app so the app.component would intercept the url and change the language of the app.

Thanks for the time you'll spend on this one

1 Answer 1

2

you need to pass an empty array instead

<a [routerLink]="[]" [queryParams]="{language: 'fr'}>FR</a>
<a [routerLink]="[]" [queryParams]="{language: 'nl'}">NL</a>
Sign up to request clarification or add additional context in comments.

1 Comment

I thought I tired it, but indeed it works, thanks m8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.