Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

How do I use ion-alert in plain javascript

$
0
0

@seantomas wrote:

I’m having trouble getting an ion-alert to display for a plain javascript (ionic via CDN) site. The ionic documentation for ion-alert and Javascript shows the following:

function presentAlert() {
  const alert = document.createElement('ion-alert');
  alert.header = 'Alert';
  alert.subHeader = 'Subtitle';
  alert.message = 'This is an alert message.';
  alert.buttons = ['OK'];

  document.body.appendChild(alert);
  return alert.present();
}

However, this only ever results in: “TypeError: alert.present is not a function”

What am I missing?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



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