My current URL:
http://localhost:4200/app/projects/ABC1/dashboards/5f6cc1e632acae2b16160123
What I want to do is that when I click on a button, that the URL gets changed to
http://localhost:4200/app/projects/ABC1/dashboards/new
I am trying it with routerLink
<button [routerLink]="['./projects/' + projectId + '/dashboards/new']">
but how can I replace projectId
with the variable that I have in that place?
I also tried to pass a function to routerLink which returns the following
public routeToCreateDashboard = (projectId: string): string => {
return `./projects/${projectId}/dashboards/new`;
};
but this doesnt work too.