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

问题描述 投票:0回答:1

在这里我使用Angular2 Lazy Loading参数基于Routing Plase帮助为什么我得到Error: Cannot match any routes: 'EditById/1113'这里我从表中传递此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}
]
angular2-routing
1个回答
1
投票

它应该是,

this._router.navigate(['EditById', this.id])
© www.soinside.com 2019 - 2024. All rights reserved.