-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathmodal-options-generic.component.ts
More file actions
38 lines (35 loc) · 1.19 KB
/
modal-options-generic.component.ts
File metadata and controls
38 lines (35 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Component, inject } from '@angular/core';
import { IonContent, IonHeader, IonTitle, IonToolbar, IonButton, ModalController } from '@ionic/angular/standalone';
import type { ModalOptions } from '@ionic/angular/standalone';
import { GenericModalComponent } from './modal/modal.component';
@Component({
selector: 'app-modal-options-generic',
template: `
<ion-header>
<ion-toolbar>
<ion-title>Modal Options Generic Test</ion-title>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<ion-button id="open-modal" (click)="openModal()">
Open Modal
</ion-button>
</ion-content>
`,
standalone: true,
imports: [IonContent, IonHeader, IonTitle, IonToolbar, IonButton],
})
export class ModalOptionsGenericComponent {
private modalController = inject(ModalController);
async openModal() {
// Regression: ModalOptions<T> must accept a generic type parameter (#31012)
const opts: ModalOptions<typeof GenericModalComponent> = {
component: GenericModalComponent,
componentProps: {
greeting: 'hello world',
},
};
const modal = await this.modalController.create(opts);
await modal.present();
}
}