This is an example of my routes, this way it works when I navigate between 'org-entities' and 'org-entities/:id' but this way I have a bug that causes the OrgEntitiesPageComponent to rerender on each navigation even though its the 'same' page.
I'm trying to redirect the route '/asset-management/(tab:org-entities)' to '/asset-management/(tab:org-entities/)' which will solve all my problems but I can't managed to get the redirect to work.
EXAMPLE OF ROUTES
const routes: Routes = [
{
path: 'asset-management',
redirectTo: '/asset-management/(tab:org-entities/)',
pathMatch: 'full',
},
{
path: 'asset-management',
data: { breadcrumb: 'Asset Management' },
component: AssetManagementPageComponent,
canActivate: [AuthGuard],
children: [
{
path: 'org-entities/:id',
component: OrgEntitiesPageComponent,
outlet: 'tab',
canActivate: [AuthGuard],
},
{
path: 'org-entities',
component: OrgEntitiesPageComponent,
outlet: 'tab',
canActivate: [AuthGuard],
},
],
},
];
EXAMPLE OF HOW I TRIED TO REDIRECT
const routes: Routes = [
// solution 1
{
path: '/asset-management/(tab:org-entities)',
redirectTo: '/asset-management/(tab:org-entities/)',
pathMatch: 'full',
},
{
path: 'asset-management',
redirectTo: '/asset-management/(tab:org-entities/)',
pathMatch: 'full',
},
{
path: 'asset-management',
data: { breadcrumb: 'Asset Management' },
component: AssetManagementPageComponent,
canActivate: [AuthGuard],
children: [
{
path: 'org-entities/:id',
component: OrgEntitiesPageComponent,
outlet: 'tab',
canActivate: [AuthGuard],
},
// solution 2 - not working
{
path: 'org-entities',
redirectTo: 'org-entities/'
},
],
},
];