How can I get children object of the router?
const appRoutes: Routes = [
{
path: 'parameters',
component: AsideComponent,
children: [
{ path: '', component: ParametersComponent },
{ path: 'crypto-accounts', component: ParametersCryptoAccountsComponent },
{ path: 'withdrawal-accounts', component: ParametersWithdrawalAccountsComponent },
{ path: 'add-withdrawal-account', component: ParametersAddWithdrawalAccountComponent }
]
},
...
]
And Component
export class AsideComponent implements OnInit {
constructor(private router: Router) {
let children = this.router... ? // <-----
}
}
I have this.router, how can I get the childrens of current state?
You need https://angular.io/api/router/ActivatedRoute