Reputation: 858
I am following the doc trying to create Actionsheet. Not sure why getting the error message Property 'dismiss' does not exist on type 'ActionSheetController'
on the dismiss()
and Cannot find name someAsyncOperation
for the someAsyncOperation()
.
Did I miss anything?
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();
}
Upvotes: 0
Views: 972
Reputation: 29625
ActionSheetController does not have dismiss()
function. It is available in actionsheet
Object.
Try:
openActSheet(){
let actionSheet = this.actionSheetCtrl.create({
title:"Type",
buttons:[
{
text: 'Hour',
handler: () => {
let navTransition = actionSheet.dismiss(); //here
//....
Upvotes: 1