In my project utilizing angular 5, I have a lengthy routing file:
const homeRoutes: Routes = [
{
path: 'home', component: HomeComponent,
children: [
{
path: 'registration',
component: RegistrationComponent,
children: [
{
path: 'synthese',
component: SyntheseComponent
},
{
path: 'queue',
component: QueueComponent,
children: [
{
path: 'queue-modal',
component: QueueModalComponent
},
{
path: 'confirm',
component: ConfirmComponent
}
]
}
]
},
{
...
I am looking to pass data specifically within the "registration" path.
To achieve this, I have been advised to include it in the route like so: path: 'registration/:mydata'
.
Then, I need to subscribe to the data using ActivatedRoute.
The challenge is that not every time data needs to be passed; only in certain scenarios.
How can I handle this with minimal impact on the existing setup?