TypeScript JavaScript dialog : If you need a JavaScript or TypeScript alert “dialog” to offer “yes” and “no” options, you can use the following solution :

if (confirm('Are you sure you want to save this data ?')) {
  // Save it!
  console.log('data was saved to the database.');
} else {
  // Do nothing
  console.log('data was not saved to the database.');
}

Read also : how to set checkbox element from TypeScript ?

Laisser un commentaire