I’ve updated Ionic from beta.6 to beta.9 but I can’t get the View Child to work…
How my app works:
app.js has the main nav: <ion-nav #myNav [root]="rootPage"></ion-nav>
In app.js I set the rootPage LoginPage. When logged in the NavController sets the root TabsPage.
Now I want to log out and set the rootpage LoginPage. This worked with the app.getComponent but with the View child not…
Error: Cannot read property ‘setRoot’ of undefined
So app.js:
<ion-nav #myNav [root]="rootPage"></ion-nav>
SettingsPage.js:
import {ViewChild} from '@angular/core'; <-----
//more imports
@Component({
templateUrl: 'build/tab_Settings/Settings/SettingsPage.html',
queries: {
rootNav: new ViewChild('myNav') <-------
}
})
export class SettingsPage{
//basic class stuff
logout(){
this.rootNav.setRoot(LoginPage); <------
}
}
Thanks in advance!