<a href="#"
[routerLink]="[isTrue?'/location-1':'/location-2', '']"
[queryParams]="{id:loc.id,l:'loc'}">
Here when value of isTrue is true
/location-1/?id=1&l=loc
But when value of isTrue is false, I need
/location-2/?id=1&l=loc2&idL=2
So how do I modify parameter conditionally?
Found solution,
we can also add ternary condition before object on queryParams.
[queryParams]="isTrue?{id:loc.id,l:'loc'}:{id:loc.id,l:'loc2',idL:loc.lId}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With