2017-09-26 63 views
0

我在进行测试时点击按钮时出现问题。登录后无法点击离子菜单按钮

场景:

在登录时 - >用户需要测试并提交 - >用户被重定向主页上。但在我的主页,我不能在“菜单按钮”,点击我的Login.ts

if (this.checker == "false" || this.checker == null) { 
    this.navCtrl.setRoot(LearnertestPage); 
} else { 
    this.navCtrl.setRoot(SplashscreenPage); 
} 

我test.ts

在警报控制器

,我有这个

{ 
    text: 'Yes', 
    handler: data => { 
     this.learningStyles.push(
     [ 
     {style: "Auditory", value: AudioTotal}, 
     {style: "Logical", value: LogicalTotal}, 
     {style: "Physical", value: PhysicalTotal}, 
     {style: "Social", value: SocialTotal}, 
     {style: "Solitary", value: SolitaryTotal}, 
     {style: "Visual", value: VisualTotal}, 
     {style: "Verbal", value: VerbalTotal}] 
    ); 
     this.userChecker.update(this.currentUser, { Checker: 'true' }); 
     this.navCtrl.setRoot(SplashscreenPage); 
    } 
    } 

而且最后我的闪屏或家庭上:

HTML:

<ion-menu [content]="content"> 
<ion-content> 
<ion-item style="background-color:#00aced"> 
    <img src="./assets/img/adapt.png" height="100px" width="350px"/> 
</ion-item> 
<ion-list> 

    <button ion-item *ngFor="let p of pages" (click)="openPage(p)"> 
    <ion-icon name="{{p.icon}}"></ion-icon>&nbsp;{{p.title}} 
    </button> 

    <button ion-item (click)="doConfirm()"> 
    <ion-icon name="log-out"></ion-icon>&nbsp;Logout 
    </button> 

</ion-list> 

在splashscreen.ts

@ViewChild(Nav) nav: Nav; 
    selectedItem: any; 
    rootPage: any = ListPage; 
    selectedTheme:String; 
    icons: string[]; 
    pages: Array<{ title: string, component: any, icon: string }> 

constructor(){ 

// used for an example of ngFor and navigation 
    this.pages = [ 
     { title: 'Home', component: SplashscreenPage, icon: this.icons[0], }, 
     { title: 'Earth Science', component: LessonPage, icon: this.icons[1] }, 
     { title: 'Progress', component: ProfilePage, icon: this.icons[2] } 

    ]; 
} 


openPage(page) { 
// Reset the content nav to have just this page 
// we wouldn't want the back button to show in this scenario 
this.nav.setRoot(page.component); } 

我似乎无法点击此按钮。嗯。我究竟做错了什么? I can't seem to click on this button.

回答

0

尝试自定义切换菜单。将toggleMenu方法添加到(单击)菜单按钮

import { Component } from '@angular/core'; 
    import { MenuController } from 'ionic-angular'; 

    @Component({...}) 
    export class MyPage { 

    constructor(public menuCtrl: MenuController) { 

    } 


    toggleMenu() { 
     this.menuCtrl.toggle(); 
    } 

    } 
+0

仍然无法解决我的问题 – AngularNewbie