从离子2中的操作表中获取用户输入

时间:2017-06-24 11:14:32

标签: angularjs ionic-framework ionic2

getcode是我想从用户那里获取并传递getCoupon函数的值然后我想将结果传递给另一个警报并在message属性中显示优惠券而不获取{ {1}}

[object object]

1 个答案:

答案 0 :(得分:-2)

实施步骤

  1. 安装cordova动作表插件
  2. 在控制器中

    `@ angular / core'中的import {Component};   从'ionic-angular'导入{NavController,NavParams};   从'@ ionic-native / action-sheet'导入{ActionSheet,ActionSheetOptions};   let buttonLabelsToShow = ['通过Facebook分享','通过推特分享'];   @零件({     选择器:'page-action-sheet-demo',     templateUrl:'action-sheet-demo.html',   })   导出类ActionSheetDemoPage {
        / **行动表选项* /     选项:ActionSheetOptions = {       标题:'与世界分享这个形象',       副标题:'从各种选项中选择',       buttonLabels:buttonLabelsToShow,       addCancelButtonWithLabel:'取消',       addDestructiveButtonWithLabel:'删除',       destructiveButtonLast:true     }

    constructor(private actionSheet: ActionSheet, public navCtrl: NavController, public navParams: NavParams) {
    }
    
    ionViewDidLoad() {
      console.log('ionViewDidLoad ActionSheetDemoPage');
    }
    
    openActionSheet() {
      this.actionSheet.show(this.options).then((buttonClickedIndex: number) => {
        console.log('Button pressed is' + buttonClickedIndex)
      }).catch((err) => {
        console.log(err)
      });
    }
    

    }`

    3.在模板<button ion-button (click)="openActionSheet()">Button</button>