ionic-framework: When IonicModule and IonicPageModule exist at the same time, an error occurs
Ionic version: (check one with “x”) [ ] 1.x [ ] 2.x [x] 3.x
I’m submitting a … (check one with “x”) [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior: Reported an error: ERROR TypeError: Cannot read property ‘_getPortal’ of undefined
Expected behavior:
Popover does not need to be loaded on demand, loaded when the current component is open
Steps to reproduce:
Related code:
about.ts
`import { Component } from ‘@angular/core’;
import { IonicPage, PopoverController } from ‘ionic-angular’; import { PopoverPage } from ‘…/about-popover/about-popover’ @IonicPage() @Component({ selector: ‘page-about’, templateUrl: ‘about.html’ }) export class AboutPage { conferenceDate = ‘2047-05-17’;
constructor(public popoverCtrl: PopoverController) { }
presentPopover(event: Event) { let popover = this.popoverCtrl.create(PopoverPage); popover.present({ ev: event }); } }`
about.module.ts
` import { NgModule } from ‘@angular/core’; import { AboutPage } from ‘./about’; import { PopoverPage } from ‘…/about-popover/about-popover’ import { IonicPageModule, IonicModule } from ‘ionic-angular’;
@NgModule({ declarations: [ AboutPage, PopoverPage ], imports: [ IonicPageModule.forChild(AboutPage), IonicModule.forRoot(PopoverPage) ], entryComponents: [ AboutPage, PopoverPage ] }) export class AboutPageModule {}
`
about-popover.ts
` import { Component } from ‘@angular/core’;
import { App, IonicPage, NavController, ModalController, ViewController } from ‘ionic-angular’;
@Component({
template: <ion-list> <button ion-item (click)="close('http://ionicframework.com/docs/v2/getting-started')">Learn Ionic</button> <button ion-item (click)="close('http://ionicframework.com/docs/v2')">Documentation</button> <button ion-item (click)="close('http://showcase.ionicframework.com')">Showcase</button> <button ion-item (click)="close('https://github.com/driftyco/ionic')">GitHub Repo</button> <button ion-item (click)="support()">Support</button> </ion-list>
})
export class PopoverPage {
constructor( public viewCtrl: ViewController, public navCtrl: NavController, public app: App, public modalCtrl: ModalController ) { }
support() { this.app.getRootNav().push(‘SupportPage’); this.viewCtrl.dismiss(); }
close(url: string) { window.open(url, ‘_blank’); this.viewCtrl.dismiss(); } } `
Ionic version: (check one with “x”) [ ] 1.x [ ] 2.x [x] 3.x
I’m submitting a … (check one with “x”) [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior: Reported an error: ERROR TypeError: Cannot read property ‘_getPortal’ of undefined
Expected behavior:
Popover does not need to be loaded on demand, loaded when the current component is open
Steps to reproduce:
Related code:
`import { Component } from ‘@angular/core’;
import { IonicPage, PopoverController } from ‘ionic-angular’; import { PopoverPage } from ‘…/about-popover/about-popover’ @IonicPage() @Component({ selector: ‘page-about’, templateUrl: ‘about.html’ }) export class AboutPage { conferenceDate = ‘2047-05-17’;
constructor(public popoverCtrl: PopoverController) { }
presentPopover(event: Event) { let popover = this.popoverCtrl.create(PopoverPage); popover.present({ ev: event }); } }`
` import { Component } from ‘@angular/core’;
import { App, IonicPage, NavController, ModalController, ViewController } from ‘ionic-angular’;
@Component({
template: <ion-list> <button ion-item (click)="close('http://ionicframework.com/docs/v2/getting-started')">Learn Ionic</button> <button ion-item (click)="close('http://ionicframework.com/docs/v2')">Documentation</button> <button ion-item (click)="close('http://showcase.ionicframework.com')">Showcase</button> <button ion-item (click)="close('https://github.com/driftyco/ionic')">GitHub Repo</button> <button ion-item (click)="support()">Support</button> </ion-list>
})
export class PopoverPage {
constructor( public viewCtrl: ViewController, public navCtrl: NavController, public app: App, public modalCtrl: ModalController ) { }
support() { this.app.getRootNav().push(‘SupportPage’); this.viewCtrl.dismiss(); }
close(url: string) {
window.open(url, ‘_blank’);
this.viewCtrl.dismiss();
}
}
`
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 18 (4 by maintainers)
this solved the problem for me:
instead of:
Hello all! Update on this issue: We are currently doing a big overhaul of our navController and how it works with lazy loading. We are also working with the angular team on improving how code splitting works with Angular. We are hoping to have these fixes in the next release if testing of it goes well.
@jgw96 Can you help us ? or any info.
@jgw96 Any progress? Please feedback. Thanks!
@sfabriece I also think it should be defined as V3 tags
When can we expect a fix for this issue?