Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228603

This.app.getComponent('nav') undefined

$
0
0

export class MyApp {
  root: Type = WelcomePage;
	app:IonicApp;

	constructor(app: IonicApp, events: Events, platform: Platform, authService:AuthService) {
		this.app = app;

		let t = setTimeout(() => {
			let nav = this.app.getComponent('nav');
			console.log(nav);
		}, 100);

This code successfully gets the 'nav' component after a 100 ms delay. But if I remove the timeout, the getComponent call returns undefined. Using a timeout feels hackish, is there a better way to wait until the ion-nav component has been rendered before getting the component?


Viewing all articles
Browse latest Browse all 228603

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>