操作表到标签页不起作用离子2

时间:2016-08-19 06:55:34

标签: angular ionic-framework ionic2

离子2框架使用组件活动表。我需要后退按钮,所以当我点击定位器按钮不工作时使用nav.push

定位器tab.ts

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 个答案:

答案 0 :(得分:1)

IonicTeam将ActionSheet更新为ActionSheetController

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
  }