Just My Life & My Work

Archive for 2017 年 10 月 21 日

[Ionic][AngularJS] 動作選單 (Action Sheet)

動作選單 (Action Sheet)是個很常用到的介面,原來只要複製以下的程式碼來改就行囉!

[Ionic] 動作選單 (Action Sheet)

/**
 Theme: Action Sheet
 IDE: None
 Language: AngularJS
 Date: 106/10/16
 Author: HappyMan
 Blog: https://cg2010studio.com/
 */

      var hideSheet = $ionicActionSheet.show({
        buttons: [
         { text: '照相' },
         { text: '相簿' }
        ],
        // destructiveText: 'Delete',
        titleText: '請選擇',
        cancelText: '取消',
        cancel: function() {
            console.log('cancel add');
          },
        buttonClicked: function(index) {
          if (index == 0) {
            console.log('照相');

          }
          if (index == 1) {
            console.log('相簿');

          }
         return true;
        }
      });

記得要引用$ionicActionSheet

參考:ionic 1- $ionicActionSheet

標籤雲

%d 位部落客按了讚: