Md Ghousemohi
Md Ghousemohi

Reputation: 197

Angular2 parametr base Routing Error as Cannot match any routes

Here i'm using Angular2 Lazy Loading parameter based Routing Plase help why im Getting Error: Cannot match any routes: 'EditById/1113' Here i'm passing this Id from Table Like

     <tr *ngFor="let emp of employee">
    <td><a href="#" (click)="GetById($event,emp)">{{emp.EmpName}}</a></td>
 GetById(e, emp) {
        debugger;
        this.id = emp.Emp_Id;
        this._router.navigate(['/EditById/' + this.id])
    }

This is My MainRoute.ts

export const ApplicationRoutes:Routes= [
    { path: 'EditById/:id', loadChildren: '../modules/employee/editemployeebyidmdule#EitEmployeeModule' },

EmployeeRoute.ts

import { Routes } from "@angular/router"
import { EditEmployeeByIdComponent } from "../components/employeecomponent/editemployeebyidcomponent"
export const EmployeeRoute=[
    { path: 'id', component: EditEmployeeByIdComponent}
]

Upvotes: 0

Views: 15

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222532

It should be,

this._router.navigate(['EditById', this.id])

Upvotes: 1

Related Questions