I have a situation where, I want a resolver if the child route is a param, and not if it's a path segment. Below is my code.
{
path: 'agreement',
children: [
{
path: ':id',
component: AgreementComponent,
resolve: { agreementDetails: AgreementDetailsResolveService }
},
{
path: 'create',
component: AgreementComponent
}
]
}
When I hit the path agreement/create
, it's throwing error, as create
is considered as the value of the param id
and it's invalid.
Please help me with this.
Rearrange your route definition:
{
path: 'agreement',
children: [
{
path: 'create',
component: AgreementComponent
},
{
path: ':id',
component: AgreementComponent,
resolve: { agreementDetails: AgreementDetailsResolveService }
}
]
}