I am trying to build navigation links dynamically which also has optional paramteers
<mat-list-item *ngFor="let link of itemSummarylinks" class="app-sidenav-content">
<a mat-list-item [routerLink]="[link.routerLink,itemCode,'edit']">
{{link.name}}
</a>
</mat-list-item>
Below is the route:
{ path: 'general-product-attributes/:id', component: eneralProductAttributesDetailComponent },
{ path: 'general-product-attributes/:id/:edit', component: GeneralProductAttributesEditComponent }
if the path is :
[general-product-attributes/35/Edit] --> it should edit componenet
[general-product-attributes/35]--> it should flow to detail componement
so how to build router dynamically:
[routerLink]="[link.routerLink,itemCode,'edit']"
[routerLink]="[link.routerLink,itemCode,'']"
if i pass empty in the place of edit it should navigate to detail componenet but it give errors , how do i fix this.