Atm I am using Angular router. At the parent route, I have a component render with default state (tabIndex = 0).
Desired Behaviour: At a child route, I would like to be able to change the tabIndex state on the same component.
Options considered
1. Using data
I have successfully been able to differentiate paths by adding data
and subscribing to the activatedRoute's children's data.
this.route.children.forEach(c => c.data.subscribe(cd => console.log(cd, 'child data'))
Angular router - empty data object for child routes
2. Using parameterization
Someone also suggested that I could use a parameterized subroute and do a regex match.
Routing module segment that defines relationship:
{
path: 'parent-path/:id',
component: MyComponent,
children: [{
path: ':child-path'
component: MyComponent,
}]
},
--
What's the best way to accomplish this?
Neither option feels particularly great, especially since I will have multiple levels of parent/child relationships. Does anyone have any advice or thoughts. I haven't been able to find any other meaningful options for this and I am new to ng, so any advice or thoughts would be appreciated!