ionic-framework: Overlay components cannot find the component to present from
Short description of the problem:
Opening an overlay component in ionViewDidEnter never actually presents the component because the overlay cannot find the component that it should present from.
This is the NavPortal when opening an overlay component in ionViewDidEnter:

This is the NavPortal when opening an overlay component in a timeout in ionViewDidEnter:

Steps to reproduce:
- Try to open an overlay component such as a loading or alert in
ionViewDidEnter
Which Ionic Version? 2.0.0-beta.11
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 17 (8 by maintainers)
Hello all! Thanks for all the info. I am happy to report that this has been fixed and will be in the beta.12 release. Thanks for using Ionic!
@TheBrockEllis Good question! We normally do a few nightly releases before doing another full beta release, so the fix for this should be available before beta.12 (its already fixed on the master branch). Also, just so you know the workaround for this is to just wrap your logic that is in your
ionViewDidEnterwith a setTimeout. To downgrade back to beta.10 (although i would not recommend it as beta.11 has a ton of fixes for issues in beta.10) you can just follow the upgrade steps in our changelog backwards haha. Thanks for using Ionic! Finally, I added a test for this issue in my above pr (that has since been merged) so that we can watch out for this issue in the future.ngOnInit() { let loading: Loading = this.presentLoading(‘Carregando notícias’); this.getNoticias(5, 0) .then(res => { this.noticias = res; loading.dismiss(); }); }
presentLoading(texto: string): Loading { let loader: Loading = this.loadingController.create({ content: texto }); setTimeout(() => { loader.present(); }, 300); return loader; }
workaround…
@EralpB the current workaround is to put your
ionViewDidEnterlogic in asetTimeout. Sorry for any hassle this issue causes for you!LoadingCtrl = handles creating loading views Loading = instance of a loading view You shouldn’t have problem with TS lint if you do this: