Angular2 parametr base Routing错误为无法匹配任何路由

时间:2017-12-26 08:29:22

标签: angular2-routing

这里我使用Angular2 Lazy Loading参数路由Plase帮助我获取Error: Cannot match any routes: 'EditById/1113' 在这里,我从Table Like

传递此Id
     <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])
    }

这是我的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}
]

1 个答案:

答案 0 :(得分:1)

应该是,

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