我正在关注尝试创建动态表单的doc。不确定为什么在Property 'dismiss' does not exist on type 'ActionSheetController'
和dismiss()
上为Cannot find name someAsyncOperation
收到错误消息someAsyncOperation()
。
我错过了什么吗?
import { ActionSheetController } from 'ionic-angular';
import { IonicPage, NavController, NavParams, ModalController, ViewController } from 'ionic-angular';
constructor(
public viewCtrl: ViewController,
public navCtrl: NavController,
public actionSheetCtrl: ActionSheetController,
public modalCtrl: ModalController,
public navParams: NavParams,
) {}
openActSheet(){
let actionSheet = this.actionSheetCtrl.create({
title:"Type",
buttons:[
{
text: 'Hour',
handler: () => {
let navTransition = this.actionSheetCtrl.dismiss();
someAsyncOperation().then(() => {
console.log("text");
})
navTransition.then(() => {
this.navCtrl.pop();
});
}
},
{
text: 'Day',
handler: function(){
console.log("Day Clicked");
}
},
{
text: 'Week',
handler: function(){
console.log("Week Clicked");
}
},
{
text: 'Month',
handler: function(){
console.log("Month Clicked");
}
}
]
});
actionSheet.present();
}
答案 0 :(得分:1)
ActionSheetController 没有dismiss()
功能。它可以在actionsheet
对象中使用。
尝试:
openActSheet(){
let actionSheet = this.actionSheetCtrl.create({
title:"Type",
buttons:[
{
text: 'Hour',
handler: () => {
let navTransition = actionSheet.dismiss(); //here
//....