Ok friends, this is how you do it.
Notice the ?navID={{navID}}
and the (click)="generateNavID()"
in the Button-HTML snippet below. That's the .html part of the trick.
<button type="button" mat-icon-button routerLink="whatever-your-path-is?navID={{navID}}" (click)="generateNavID()" >click me</button>
For the .ts part, just do something like this and call it a home-run!
...
export class whatever {
...
navID: number;
...
generateNavID() {
this.navID = Math.random();
}
}
If there is anyone among you who can turn this into a one file operation, please feel free to improve this answer. It would be so much better to eliminate the need of requiring the typeScript file.
For example, the following would have been superior if it were to work:
<button type="button" mat-icon-button routerLink="whatever-your-path-is?navID={{Math.random}}" >click me</button>
This approach would not even require the need for the (click) event, neither. But, it won't work. Maybe you know of a practical way.