すべての Ionic 2 コンポーネントをテストしようとしていますが、アクションシートの使用方法がわかりません。
私はこのコードを持っています:
actionSheet.html :
<button (click)="showActionSheet()">Show Actionsheet</button>
actionSheet.js :
import {Page, NavController} from 'ionic/ionic';
import {ActionSheet} from 'ionic/ionic';
@Page({
templateUrl: 'app/actionSheet/actionSheet.html'
})
export class ActionSheetPage {
constructor(nav: NavController) {
this.nav = nav;
}
showActionSheet() {
ActionSheet.open({
buttons: [
{ text: 'Share This' },
{ text: 'Move' }
],
destructiveText: 'Delete',
titleText: 'Modify your album',
cancelText: 'Cancel',
cancel: () => {
console.log('Canceled');
},
destructiveButtonClicked: () => {
console.log('Destructive clicked');
},
buttonClicked: (index) => {
console.log('Button clicked: ', index);
}
}).then(actionSheetRef => {
// Action sheet was created and opened
this.actionSheetRef = actionSheetRef;
// this.actionSheetRef.close() to close it
})
}
}
ボタンをクリックすると、次のエラーが発生します。
19 010801 エラー 例外: 「クリック」の評価中のエラー 20 010804 エラー 元の例外: TypeError: ionic_2.ActionSheet.open は関数ではありません 21 010806 エラー 元のスタックトレース: 22 010808 エラー TypeError: ionic_2.ActionSheet.open は関数ではありません
ヒント?