In a Typescript file you can do this:
const myProperty = 'id';
const queryParams = {[myProperty]: 5};
How can this be done in a Angular template? It should be something like this:
<div
[routerLink]="../.."
[queryParams]="{[myProperty]: 5}">
Navigate to page...
</div>
This doesn't work because of the square brackets around myProperty. Does anyone have an idea?
Maybe you want to implement link-parameters-arrays?
https://angular.io/guide/router#link-parameters-array