2017-12-26 27 views
0

어떤 경로를 일치하지 않을 수있는 이유는 이것은 테이블처럼Angular2의 parametr 기반 라우팅 오류 도움이 내가 라우팅 Plase 기반 Angular2 게으른로드 매개 변수를 사용하고 여기에

 <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]) 
    } 

에서이 ID를 통과하고있어 여기에 Error: Cannot match any routes: 'EditById/1113' 얻기 메신저 내 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

그것은해야한다, 어떤 경로를 일치하지 않을 수있는 오류에도 불구하고

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

: 'EditById/1108' –

+0

인가가 우리가 ngOnInit에서 아무것도 필요 –