export class MainPage {
selectedTab = 0;
pages = [];
// pages = [
// { pageName: 'HomePage', title: 'Home', id: 'homeTab'},
// { pageName: 'FishIntelPage', title: 'Fishing Intel',id: 'fishIntelTab'},
// { pageName: 'NotificationPage', title: 'Notifications', id: 'notficationTab'},
// { pageName: 'LiveStreamingPage', title: 'Live Streaming', id: 'liveStreamingTab'},
// { pageName: 'DiscoverPage', title: 'Discovery', id: 'discoverTab'},
// { pageName: 'KyndofishingPopoverPage', title: 'Community Website',id: 'kyndofishingTab'},
// { pageName: 'ProfilePage', title: 'Personal Profile',id: 'peProTab'}
// ];
@ViewChild(SuperTabs) superTabs: SuperTabs;
constructor(private navCtrl: NavController,
private navParams: NavParams,
private alertCtrl: AlertController,
private storage: Storage) {
this.storage.get('role_id').then((role_id) => {
console.log('role_id', role_id);
if(role_id==2) {
this.pages = [
{ pageName: 'HomePage', title: 'Home', id: 'homeTab'},
{ pageName: 'FishIntelPage', title: 'Fishing Intel',id: 'fishIntelTab'},
{ pageName: 'NotificationPage', title: 'Notifications', id: 'notficationTab'},
{ pageName: 'LiveStreamingPage', title: 'Live Streaming', id: 'liveStreamingTab'},
{ pageName: 'DiscoverPage', title: 'Discovery', id: 'discoverTab'},
{ pageName: 'KyndofishingPopoverPage', title: 'Community Website',id: 'kyndofishingTab'},
{ pageName: 'ProfilePage', title: 'Personal Profile',id: 'peProTab'}
];
}
else if(role_id==3) {
this.pages = [
{ pageName: 'HomePage', title: 'Home', id: 'homeTab'},
{ pageName: 'FishIntelPage', title: 'Fishing Intel',id: 'fishIntelTab'},
{ pageName: 'NotificationPage', title: 'Notifications', id: 'notficationTab'},
{ pageName: 'LiveStreamingPage', title: 'Live Streaming', id: 'liveStreamingTab'},
{ pageName: 'DiscoverPage', title: 'Discovery', id: 'discoverTab'},
{ pageName: 'KyndofishingPopoverPage', title: 'Community Website',id: 'kyndofishingTab'},
{ pageName: 'Profile1Page', title: 'Business Profile',id: 'buProTab'}
];
}
});
}
In above code when I initialize the pages outside the constructor it working fine but when Iām initializing the pages inside the constructor then it will throw the error
āERROR Error: Uncaught (in promise): TypeError: Cannot read property āgetActiveChildNavsā of undefinedā
Please help anyone!
Thanks!