import { Component , ContentChild , ElementRef , AfterContentInit , ViewChild } from '@angular/core' ; import { IonApp } from '@ionic/angular' ; import { RouterOutletComponent } from '../router-outlet/router-outlet.component' ; import { ModalController } from '../modal/services/modal.controller' ; @ Component ( { selector : 'kirby-app' , templateUrl : './app.component.html' , styleUrls : [ './app.component.scss' ] , } ) export class AppComponent implements AfterContentInit { @ ViewChild ( IonApp , { static : true , read : ElementRef } ) private ionAppElement : ElementRef < HTMLIonAppElement > ; @ ContentChild ( RouterOutletComponent , { static : false , read : ElementRef } ) private routerOutlet ? : ElementRef < HTMLElement > ; constructor ( private modalController ) { } ngAfterContentInit ( ) { if ( this . routerOutlet && this . routerOutlet . nativeElement ) { this . modalController . registerPresentingElement ( this . routerOutlet . nativeElement ) ; } this . ionAppElement . nativeElement . componentOnReady ( ) . then ( ( ) => this . registerInputs ( ) ) ; } registerInputs ( ) { const ensureIonicDeviceHacksDelay = 250 ; setTimeout ( ( ) => { document . querySelectorAll ( 'kirby-form-field' ) . forEach ( ( formField ) => { formField . dispatchEvent ( new CustomEvent ( 'kirbyRegisterFormField' ) ) ; } ) ; } , ensureIonicDeviceHacksDelay ) ; } }