docs(modal): update angular usage for consistent modalController (#23127)

This commit is contained in:
William Martin
2021-03-31 20:25:28 -04:00
committed by GitHub
parent 27318cf585
commit b7b97ce4cc
2 changed files with 6 additions and 6 deletions

View File

@ -125,7 +125,7 @@ export class ModalPage {
dismiss() { dismiss() {
// using the injected ModalController this page // using the injected ModalController this page
// can "dismiss" itself and optionally pass back data // can "dismiss" itself and optionally pass back data
this.modalCtrl.dismiss({ this.modalController.dismiss({
'dismissed': true 'dismissed': true
}); });
} }
@ -200,14 +200,14 @@ In most scenarios, using the `ion-router-outlet` element as the `presentingEleme
```javascript ```javascript
import { ModalController } from '@ionic/angular'; import { ModalController } from '@ionic/angular';
constructor(private modalCtrl: ModalController) {} constructor(private modalController: ModalController) {}
async presentModal() { async presentModal() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: ModalPage, component: ModalPage,
cssClass: 'my-custom-class', cssClass: 'my-custom-class',
swipeToClose: true, 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(); return await modal.present();
} }

View File

@ -82,7 +82,7 @@ export class ModalPage {
dismiss() { dismiss() {
// using the injected ModalController this page // using the injected ModalController this page
// can "dismiss" itself and optionally pass back data // can "dismiss" itself and optionally pass back data
this.modalCtrl.dismiss({ this.modalController.dismiss({
'dismissed': true 'dismissed': true
}); });
} }
@ -157,14 +157,14 @@ In most scenarios, using the `ion-router-outlet` element as the `presentingEleme
```javascript ```javascript
import { ModalController } from '@ionic/angular'; import { ModalController } from '@ionic/angular';
constructor(private modalCtrl: ModalController) {} constructor(private modalController: ModalController) {}
async presentModal() { async presentModal() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: ModalPage, component: ModalPage,
cssClass: 'my-custom-class', cssClass: 'my-custom-class',
swipeToClose: true, 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(); return await modal.present();
} }