Hi, I have a problem on navigation from tabs and their children : for example, this is my tabs routing :
const routes: Routes = [
{
path: 'tabs',
component: TabsPage,
children: [
{
path: 'new-traitement',
children: [
{
path: '',
loadChildren: () =>
import('../new-traitement/new-traitement.module').then(m => m.NewTraitementPageModule)
},
{
path: 'question',
children: [
{
path: '',
loadChildren: () =>
import('../question-traitement/question-traitement.module').then(m => m.QuestionTraitementPageModule)
}
]
},
{
path: 'question2',
children: [
{
path: '',
loadChildren: () =>
import('../question2-traitement/question2-traitement.module').then(m => m.Question2TraitementPageModule)
}
]
}
]
},
{
path: 'traitements',
children: [
{
path: '',
loadChildren: () =>
import('../traitements/traitements.module').then(m => m.TraitementsPageModule)
},
{
path: 'detail',
children: [
{
path: '',
loadChildren: () =>
import('../detail-traitement/detail-traitement.module').then(m => m.DetailTraitementPageModule)
}
]
}
]
},
{
path: 'soins',
children: [
{
path: '',
loadChildren: () =>
import('../soins/soins.module').then(m => m.SoinsPageModule)
},
{
path: 'detail',
children: [
{
path: '',
loadChildren: () =>
import('../detail-soin/detail-soin.module').then(m => m.DetailSoinPageModule)
}
]
}
]
},
{
path: '',
redirectTo: '/tabs/traitements',
pathMatch: 'full'
}
]
},
{
path: '',
redirectTo: '/tabs/traitements',
pathMatch: 'full'
}
];
when I navigate to ‘new-traitement’ by clicking in the first tab, I go to the page ‘/tabs/new-traitement’. inside this page, I have a button which goes to ‘question’ --> ‘/tabs/new-traitement/question’, until here, all is OK.
If I click to another tab, and i come back in the first tab, I didn’t go to the ‘/tabs/new-traitement’ page but to ‘/tabs/new-traitement/question’ page. It’s a good thing because it keeps in mind my precedent action on the first tab.
Now, I have another button in ‘/tabs/new-traitement/question’ page which redirect me to another page in an other tab (’/tabs/traitements/detail’). But now, what I want is if I click on the first Tab, I don’t want to be redirected to ‘/tabs/new-traitement/question’ page but to ‘/tabs/new-traitement’ page. I don’t want to keep in mind my first action but initialize the first tab.
How I can do this?
I Have found some parameters on angular Router (extras) to use un NavigateByUrl but I have found any parameter which works
https://angular.io/api/router/NavigationExtras