mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
docs(toast): fix angular usage
The create method returns a promise. Other examples deal with this using async-await, so I did the same thing in this instance.
This commit is contained in:
committed by
Manu MA
parent
34ae9045b7
commit
a04197baef
@ -11,16 +11,16 @@ export class ToastExample {
|
|||||||
|
|
||||||
constructor(public toastController: ToastController) {}
|
constructor(public toastController: ToastController) {}
|
||||||
|
|
||||||
presentToast() {
|
async presentToast() {
|
||||||
const toast = this.toastController.create({
|
const toast = await this.toastController.create({
|
||||||
message: 'Your settings have been saved.',
|
message: 'Your settings have been saved.',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
toast.present();
|
toast.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
presentToastWithOptions() {
|
async presentToastWithOptions() {
|
||||||
const toast = this.toastController.create({
|
const toast = await this.toastController.create({
|
||||||
message: 'Click to Close',
|
message: 'Click to Close',
|
||||||
showCloseButton: true,
|
showCloseButton: true,
|
||||||
position: 'top',
|
position: 'top',
|
||||||
|
|||||||
Reference in New Issue
Block a user