mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
32 lines
671 B
TypeScript
32 lines
671 B
TypeScript
import { Component, NgZone } from '@angular/core';
|
|
import { AlertController } from '@ionic/angular';
|
|
import { NavComponent } from '../nav/nav.component';
|
|
|
|
@Component({
|
|
selector: 'app-alert',
|
|
templateUrl: './alert.component.html',
|
|
})
|
|
export class AlertComponent {
|
|
|
|
constructor(
|
|
private alertCtrl: AlertController
|
|
) { }
|
|
|
|
async openAlert() {
|
|
const alert = await this.alertCtrl.create({
|
|
header: 'Hello',
|
|
message: 'Some text',
|
|
buttons: [
|
|
{
|
|
role: 'cancel',
|
|
text: 'Cancel',
|
|
handler: () => {
|
|
NgZone.assertInAngularZone();
|
|
}
|
|
}
|
|
]
|
|
});
|
|
await alert.present();
|
|
}
|
|
}
|