Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230047

Unable to add 'title' to AlertController in Ionic 6 app

$
0
0

I am trying to add an AlertController to my Ionic 6 app with the below code:

presentAlert() {
  let alert = this.alertCtrl.create({
    title: 'Low battery',
    subTitle: '10% of battery remaining',
    buttons: ['Dismiss']
  });
  alert.present();
}

However, my IDE is throwing this error message under title: 'Low battery':

Argument of type ‘{ title: string; subTitle: string; buttons: {}; }’ is not assignable to parameter of type ‘AlertOptions’.
Object literal may only specify known properties, and ‘title’ does not exist in type ‘AlertOptions’.

I am copying this code from the ionic documentation, so I don’t know why it’s throwing an error. Can someone please tell me why this is, & how it can be resolved?


Viewing all articles
Browse latest Browse all 230047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>