mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +08:00
docs(modal): update angular usage for consistent modalController (#23127)
This commit is contained in:
@ -125,7 +125,7 @@ export class ModalPage {
|
||||
dismiss() {
|
||||
// using the injected ModalController this page
|
||||
// can "dismiss" itself and optionally pass back data
|
||||
this.modalCtrl.dismiss({
|
||||
this.modalController.dismiss({
|
||||
'dismissed': true
|
||||
});
|
||||
}
|
||||
@ -200,14 +200,14 @@ In most scenarios, using the `ion-router-outlet` element as the `presentingEleme
|
||||
```javascript
|
||||
import { ModalController } from '@ionic/angular';
|
||||
|
||||
constructor(private modalCtrl: ModalController) {}
|
||||
constructor(private modalController: ModalController) {}
|
||||
|
||||
async presentModal() {
|
||||
const modal = await this.modalController.create({
|
||||
component: ModalPage,
|
||||
cssClass: 'my-custom-class',
|
||||
swipeToClose: true,
|
||||
presentingElement: await this.modalCtrl.getTop() // Get the top-most ion-modal
|
||||
presentingElement: await this.modalController.getTop() // Get the top-most ion-modal
|
||||
});
|
||||
return await modal.present();
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ export class ModalPage {
|
||||
dismiss() {
|
||||
// using the injected ModalController this page
|
||||
// can "dismiss" itself and optionally pass back data
|
||||
this.modalCtrl.dismiss({
|
||||
this.modalController.dismiss({
|
||||
'dismissed': true
|
||||
});
|
||||
}
|
||||
@ -157,14 +157,14 @@ In most scenarios, using the `ion-router-outlet` element as the `presentingEleme
|
||||
```javascript
|
||||
import { ModalController } from '@ionic/angular';
|
||||
|
||||
constructor(private modalCtrl: ModalController) {}
|
||||
constructor(private modalController: ModalController) {}
|
||||
|
||||
async presentModal() {
|
||||
const modal = await this.modalController.create({
|
||||
component: ModalPage,
|
||||
cssClass: 'my-custom-class',
|
||||
swipeToClose: true,
|
||||
presentingElement: await this.modalCtrl.getTop() // Get the top-most ion-modal
|
||||
presentingElement: await this.modalController.getTop() // Get the top-most ion-modal
|
||||
});
|
||||
return await modal.present();
|
||||
}
|
||||
|
Reference in New Issue
Block a user