问题
while using child routing in angular2 RC-4 getting this error
Cannot read property 'pathsWithParams' of undefined
my routing file contains
export const routes: RouterConfig = [
{ path: '', component: HomeComponent },
{ path: 'demo', component: DummyComponent },
{ path: 'user-profile', component: UserProfileComponent,
children:[
{ path: '', component: ProfileOverview },
{ path: 'smart-points', component: ProfileSmartPoints }
]},
]
any idea ?
update
The problem is actully whenever i use routerLinkActive
in the html side
回答1:
Got the answer thanks @micronyks
actually the probelm is we have to use the property [routerLinkActiveOptions]="{exact: true}"
while using
routerLinkActive="active-link"
in the html for checking active route.
so the correct syntax for this is :
<a routerLinkActive="active" [routerLinkActiveOptions]="{exact:true}" [routerLink]='["./Dummy"]'>Dummy</a>
来源:https://stackoverflow.com/questions/38673498/angular2rc-4-cannot-read-property-pathswithparams-of-undefined