I have added a page via ionic g page ProfilePopup which I’m calling like this:
let customModal = this.modalCtrl.create(ProfilePopup);
customModal.present();
Please help!!! I’m going crazy!!!
I somehow need to be able to make this modal popup in a small size without affecting other modals, in fact, I need a different size for each modal.
Yeah, I couldn’t find a nice way to do it either - It seems to be possible to apply a class to the parent .modal-wrapper from within the modal component though, but it’s pretty hacky!
If you only show one at a time, It might be a better idea to just apply a class to the body when you open one? - I couldn’t do that as I wanted to be able to have a tiny modal above a larger one sometimes …
Hello I want to use the same style to add style in several modals, but where is the import of ElementRef ? is it the parent page wich call the presentation of the modal.
e.g if I call modal from CallerPage class, would I have to declare that
import { CallerPage } from '../myPath/CallerPage;
constructor(private ele:CallerPage)`
ElementRef is one of Angular’s classes - You can import it from the angular core package :
import { ElementRef } from "@angular/core";
ElementRef just represents a native dom element - When you let Angular’s DI inject one in the constructor as above, the value given is the element of the current component.
When you create a modal in Ionic, It’ll place your component within an instance of the Ionic modal component, which is why you can see the code sample above accessing the actual modal through the parentElement property…