Aux route inside child route, don't know how to set to let it work. i have root component and route config file like:
root.routes.ts
export const rootRoute:RouterConfig=[
...ChildrenRoute,
{path:'',component:ChildrenRootComponent},
{path:'children-root',component:ChildrenRootComponent},
{path:'other',component:OtherComponent'}
];
template:
'<a routerLink='children-root'>Children root</a>
<a routerLink='other'>Other</a>
<router-outlet></router-outlet>'
and ChildrenRootComponent have FirstComponent and SecondComponent with routes config file like:
children.routes.ts
export const ChildrenRoute:RouterConfig=[
{path:"",redirectTo:'/children-root',pathMatch:'full'},
{path:'children-root',component:ChildrenRootComponent,
children:[
{path:'',component:FirstComponent},
{path:'first',component:FirstComponent},
{path:'second',component:SecondComponent,outlet:'aux'}
]
}
];
template:
' <a routerLink='first'>First</a>
<router-outlet></router-outlet>
<a routerLink='aux:second'>Second</a>
<router-outlet name="aux"></router-outlet>'
Now route from Children root -> Second is ok, but route Children root -> first doesn't work show error:
Error: Cannot match any routes: 'children-root/second'
change template:
' <a routerLink='first'>First</a>
<router-outlet></router-outlet>
<a routerLink='(aux:second)'>Second</a>
<router-outlet name="aux"></router-outlet>'
doesn't work too. error:
Error: Cannot match any routes: 'children-root/second)'
pay attention here ')' in error message,and no '(' . directly set url as following in browser
localhost:4200/children-root/(aux:second)
reload and work well. so i guess i set routerLink wrong, search a lot, no find anything about this.