Komal Sharma

Komal Sharma

  • NA
  • 103
  • 18.7k

Error in routing in angular ver. 2+ ?

Jul 6 2018 1:15 AM
I was creating a routing, without children it was working fine, but when i added children then it generates an error, please look into code :
  1. {path:'', redirectTo:'/students', pathMatch:'full'},  
  2. {  
  3.        path:'students',   
  4.        component:StudentsComponent,  
  5.        children:[  
  6.            {path:'',component:StudentStartComponent},  
  7.            {path:':id',component:StudentDetailComponent},  
  8.            {path:':id/edit',component:StudentEditComponent}  
  9.            {path:'new',component:StudentEditComponent},  
  10.         ]  
  11.  },  
  12. {path:'subjects-list', component:SubjectsListComponent}, 
 But in the above code, i have an issue "cannot read property studentId".

Answers (4)