I encounter a problem on my application since I upgraded it to Beta-7.
I can’t close my LeftMenu, because the getComponent function has been deleted in this Ionic version.
So I understood that
let nav = this.app.getComponent('nav');
had to be replaced with :
@ViewChild(Nav) nav: Nav;
which works fine.
But how can I replace the following :
this.app.getComponent('leftMenu').close();
? Thanks by advance !
For information, here is my app.html structure : (which I found in a Ionic template months ago)
Menu also has a MenuController that can be used from any page. The conference app uses this, for example:
import {MenuController} from 'ionic-angular';
@Page({
templateUrl: 'build/pages/tutorial/tutorial.html'
})
export class TutorialPage {
constructor(private menu: MenuController) { }
onPageDidEnter() {
// the root left menu should be disabled on the tutorial page
this.menu.enable(false);
}
}
import {Nav, Menu} from 'ionic-angular';
....
class MyApp {
private app;
private platform;
private pages;
@ViewChild(Nav) nav: Nav;
@ViewChild(Menu) menu: Menu;
constructor(app: IonicApp, platform: Platform, private authHttp: AuthHttp, private auth: AuthService) {
....
}
openPage(page) {
// close the menu when clicking a link from the menu
// navigate to the new page if it is not the current page
this.menu.close();
this.nav.setRoot(page.component);
}
}