这里我使用Angular2 Lazy Loading参数路由Plase帮助我获取Error: Cannot match any routes: 'EditById/1113'
在这里,我从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])
}
这是我的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}
]
答案 0 :(得分:1)
应该是,
this._router.navigate(['EditById', this.id])