I don't know why my routing has not happened.
so far
<table mat-table [dataSource]="searchResult_DS" class="mat-elevation-z8">
<ng-container [matColumnDef]="column" *ngFor="let column of displayedColumns">
<th mat-header-cell *matHeaderCellDef> {{column}} </th>
<td mat-cell *matCellDef="let element" > {{element[column]}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"
[routerLink] = "['/show-this-user-page', row.custId]"
(click)=highlightSelectedRow(row) [ngClass]="{ 'bg-clr': row === selectedRow }">
</tr>
</table>
right now, am having a table with the list of data. whenever the user selects particular row it should navigate to the next page
public highlightSelectedRow(row): void
{
this.picked = row.custId;
// i can able get values from here
//do i need to add below line here.?
//this.router.navigate(['/show-this-user-page']);
}
routing.ts
const routes: Routes = [
{
path: 'Here-where-am-doingStuffes',
canActivate: [AuthenticationGuard],
component: Here-where-am-doingStuffes
// this page landing with my mat-table- then am doing routing on row
},
{
path: 'sample route 1',
canActivate: [AuthenticationGuard],
component: sample-route-1
},
{
path: 'sample route 1',
canActivate: [AuthenticationGuard],
component: sample-route-2
},
{
path: 'second-main-data',
loadChildren: '/some-other-module/someother-data.module#SecondMainModule'
}
];
Error
ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'routerLink' since it isn't a known property of 'td'. ("header-cell *matHeaderCellDef> {{column}} ][routerLink] = "['/show-this-user', element.email]"> {{element[column]}} "): ng:///AdminModule/searchUser.html@35:51 Error: Template parse errors: Can't bind to 'routerLink' since it isn't a known property of 'td'. ("header-cell *matHeaderCellDef> {{column}} ][routerLink] = "['/show-this-user', element.email]"> {{element[column]}} "): ng:///AdminModule/searchUser.html@35:51
could someone tell me where should I've to change my code and what else needs to be added? it would so helpful if you share the working demo.
RoutingModule
in the module that the control is in. Without that, the compiler doesn't know what to do with that directive. – R. Richards