Hello fellow Ionic developers,
The following is the new way of launching a modal, from my understanding, can be done with async/await or just with .then. Taken from beta.ionicframework.com website, this is the modal-example.ts:
import { Component } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { ModalPage } from '../modal/modal.page';
@Component({
selector: 'modal-example',
templateUrl: 'modal-example.html',
styleUrls: ['./modal-example.css']
})
export class ModalExample {
constructor(public modalController: ModalController) {}
async presentModal() {
const modal = await this.modalController.create({
component: ModalPage,
componentProps: { value: 123 }
});
return await modal.present();
}
}
Of course in modal-example.html
<ion-button (click)="presentModal()">Launch Modal</ion-button>
Question:
How to load the page on the modal? When the button is pressed I keep getting error, Component factory was not found.
I tried loading the page normally (declaring at app.module.ts and modal-example.ts) and via lazy load but was not able to launch a modal. I understand that to launch a Modal Controller in Ionic 3, you can do it with lazy load, any ideas?