I am trying to find out if there is a more optimized way to share the same resolver between two child routes for sisters. The following is an example of how routes are connected to transducers.
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
export const routes = [{
path: '',
component: parentComponent,
canActivate: [AuthGuard],
resolve: {
someData: someDataResolver
},
children: [
{ path: '', redirectTo: '0', pathMatch: 'full' },
{ path: '0',
component: someComponent1,
resolve: {
someData1: someData1Resolver,
someData2: someData2Resolver,
}
},
{ path: '2',
component: someComponent2,
resolve: {
someData2: someData2Resolver
}
}
... a bunch more children routes/components with resolvers
]
}]
Currently, I repeat the calls of the resonators for each route for children, which, in my opinion, are not optimal. Does anyone know if there is a better way to share data from a common child resonator of a child node? I thought about setting the data from the duplicate converter to the shared service, and then another child route to access the data from the service (instead of making another api call in the converter). Are there other better solutions?