typescript - Ionic 3 menu sidebar -
i want disable menu on login page but got error :
this.menuctrl.enable not function
here code of app.html :
<ion-split-pane> <ion-menu id="loggedinmenu" [content]="content"> <ion-header> <ion-toolbar> <ion-title>menu</ion-title> </ion-toolbar> </ion-header> <ion-content class="outer-content"> <ion-list> <button ion-item menuclose *ngfor="let p of apppages" (click)="openpage(p)"> <ion-icon item-start [name]="p.icon" ></ion-icon> {{p.title}} </button> </ion-list> </ion-content> </ion-menu> <!-- main navigation --> <ion-nav [root]="rootpage" #content swipebackenabled="false" main name="app"></ion-nav> </ion-split-pane>
and here code of app.component.ts :
import { component, viewchild } '@angular/core'; import { platform,menucontroller, nav, } 'ionic-angular'; import { statusbar } '@ionic-native/status-bar'; import { splashscreen } '@ionic-native/splash-screen'; import { homepage } '../pages/home/home'; import { loginpage } '../pages/login/login'; import { mainpage } '../pages/main/main'; import { mydogspage } '../pages/my-dogs/my-dogs'; import { mycoursespage } '../pages/my-courses/my-courses'; import { friendspage } '../pages/friends/friends'; import { trainerspage } '../pages/trainers/trainers'; export interface pageinterface { title: string; component: any; icon: string; } @component({ templateurl: 'app.html' }) export class myapp { @viewchild(nav) nav: nav; apppages: pageinterface[] = [ { title: 'account', component: mainpage, icon: 'finger-print' }, { title: 'my dogs', component: mydogspage, icon: 'paw' }, { title: 'my course', component: mycoursespage, icon: 'book' }, { title: 'friends', component: friendspage, icon: 'people' }, { title: 'my trainers', component: trainerspage, icon: 'man' }, ]; rootpage:any; constructor(platform: platform, statusbar: statusbar, splashscreen: splashscreen) { this.rootpage=(localstorage.disableintro? loginpage:homepage) if (localstorage.getitem('token')) { this.rootpage(mainpage); console.log('true'); } platform.ready().then(() => { // okay, platform ready , our plugins available. // here can higher level native things might need. statusbar.styledefault(); splashscreen.hide(); }); } }
and here constructor of login.ts page
constructor(public menuctrl: menucontroller,private alertctrl: alertcontroller, public navctrl: navcontroller, public navparams: navparams, public authenticationprovider: authenticationprovider, public loadingctrl: loadingcontroller) { this.navctrl = navctrl; this.menuctrl.enable(false,'loggedinmenu'); }
i don't know why enable function don't work on project work asked in post i've read . please continue working on project .
Comments
Post a Comment