Hello Ionites.
I have the tab root page (CustomerRootTabPage) with 3 tabpages (CustomerDetailTab, CustomerContactsTabPage, CustomerActivitiesTabPage).
Wenn I pass the paramter customerId from StartPage to CustomerRootTabPage, the parameter customerId is accessible only on tab root page, but is not accessible on tabpages.
I need to access this parameter on tabpages. Please help me
StartPage:
<ion-card-content [routerLink]="'/customer/' + customer.customerId" routerDirection="forward">
=========================================================================
app.routing.module
const routes: Routes = [
{ path: '', loadChildren: './dashboard/dashboard.module#DashboardPageModule' },
{ path: 'customer/:customerId', loadChildren: './customer-root-tab/customer-root-tab.module#CustomerRootTabPageModule' }}
]
=========================================================================
CustomerRootTabPageRoutingModule.ts
const routes: Routes = [
{
path: 'customer',
component: CustomerRootTabPage,
children: [
{
path: 'customer-detail-tab',
children: [
{
path: '',
loadChildren: '../customer-tabs/customer-detail-tab/customer-detail-tab.module#CustomerDetailTabPageModule'
}
]
},
{
path: 'customer-contacts-tab',
children: [
{
path: '',
loadChildren: '../customer-tabs/customer-contacts-tab/customer-contacts-tab.module#CustomerContactsTabPageModule'
}
]
},
{
path: 'customer-activities-tab',
children: [
{
path: '',
loadChildren: '../customer-tabs/customer-activities-tab/customer-activities-tab.module#CustomerActivitiesTabPageModule'
}
]
},
{
path: '',
redirectTo: '/customer-detail-tab',
pathMatch: 'full'
}
]
},
{
path: '',
redirectTo: 'customer/customer-detail-tab',
pathMatch: 'full'
}
];
@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule]
})
export class CustomerRootTabPageRoutingModule {}
=========================================================================
With works fine: CustomerRootTabPage.ts
export class CustomerRootTabPage implements OnInit {
constructor(private activatedRoute: ActivatedRoute) {}
ngOnInit() {
let customerId = this.activatedRoute.snapshot.paramMap.get('customerId');
console.log("customerId" + customerId); **// customerId is ok**
}
=========================================================================
With not : CustomerDetailTabPage.ts
ngOnInit() {
let customerId = this.activatedRoute.snapshot.paramMap.get('customerId');
console.log("customerId" + customerId); // **customerId null !!!!!**
Thnx