2016-08-19 5 views
0

ionic 2 framework for component action sheet私は、ロケータボタンをクリックしたときにそうアクションシートがタブページに作用しないionic 2

import {Component} from '@angular/core' 
import {firstLocator} from '../atm-locator/atm-locator'; 
import {secoundLocator} from '../bank-locator/bank-locator'; 

    @Component({ 
     templateUrl: 'build/pages/more-services/locator-tab/locator-tab.html' 
    }) 
    export class locatorTab { 

     private tab1Root: any; 
     private tab2Root: any; 


     constructor() { 
     this.tab1Root = firstLocator; 
     this.tab2Root = secoundLocator; 
     } 
    } 

file.ts

openMenu() { 
     let actionSheet = ActionSheet.create({ 

      cssClass: 'serviceMenu', 
      buttons: [ 
      { 
       text: 'locator', 
       role: 'destructive', 
       icon: 'ios-compass' , 
       handler:() => { 
       this.nav.push(locatorTab); 
       // let navTransition = actionSheet.dismiss(); 
      } 
      }, 

      { 
       text: 'Refer a Friend', 
       icon: 'md-volume-up', 
       handler:() => { 
       console.log('Favorite clicked'); 
       } 
      } 

      ] 
     }); 

     this.nav.present(actionSheet); 
     } 

答えて

1

IonicTeamが ActionSheetController

にActionSheet更新が

ロケータ-tab.tsを働いていないnav.pushを使用して[戻る]ボタンを必要とします

import { ActionSheetController } from 'ionic-angular';  <--NEW 
constructor(public actionSheetCtrl: ActionSheetController){} <--NEW 

openMenu() { 
    let actionSheet = this.actionSheetCtrl.create({  <--NEW 

     cssClass: 'serviceMenu', 
     buttons: [ 
     { 
      text: 'locator', 
      role: 'destructive', 
      icon: 'ios-compass' , 
      handler:() => { 
      this.nav.push(locatorTab); 
      // let navTransition = actionSheet.dismiss(); 
     } 
     }, 

     { 
      text: 'Refer a Friend', 
      icon: 'md-volume-up', 
      handler:() => { 
      console.log('Favorite clicked'); 
      } 
     } 

     ] 
    }); 

    actionSheet.present();   <--- NEW 
    } 
関連する問題