routerLink on button elements doesn't work


I have a dashboard which is contain some information from firebase
and i have a button Like this (more) enter image description here

and when i click on it, it doesn’t work or redirect me to my specific page
this my code in html file

<table class="table table-inverse">
        <th scope="col">First Name</th>
        <th scope="col">Last Name</th>
        <th scope="col">Email </th>
        <th scope="col">Country</th>
        <th scope="col">City</th>
        <th scope="col">Salary</th>
        <th scope="col">ID</th>
        <th scope="col">Action</th>
    <tbody >
      <tr *ngFor="let item of employees">
        <th >{{item.firstName}}</th>
        <th >{{item.lastName}}</th>
        <th >{{}}</th>
        <th >{{}}</th>
        <th >{{}}</th>
        <th >{{item.salary}}</th>
        <th >{{item.key}}</th> 
        <th> <a href="" [routerLink]="['/employee/employee/]" class="btn btn-primary">more <i class="fa fa-info-circle" ></i>

i have import this in the app.module.ts

import { RouterModule, Routes} from '@angular/router';

And also i added this in the route config



[routerLink]="['/employee/employee/]” your routerLink not match with your routes it should be like {path:'employee/:id',component:EmployeeInfoComponent}, . And you missed close single quotes.
Try to this [routerLink]="['/employee/, item.key]”

Answered By – Suhag Lapani88

Answer Checked By – Pedro (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.