Skip to content

Commit 9453132

Browse files
authored
fix(angular): overlays are defined when using standalone controllers (#28560)
Issue number: resolves #28385 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Overlay controllers do not register their respective overlays components. This results in the overlay not appearing. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Each standalone overlay controller manually calls `defineCustomElement` for their respective overlay component to ensure the component is loaded/registered. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev build: `7.5.6-dev.11700492285.1581ed02`
1 parent c07312e commit 9453132

File tree

7 files changed

+10
-4
lines changed

7 files changed

+10
-4
lines changed

packages/angular/standalone/src/providers/action-sheet-controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { Injectable } from '@angular/core';
22
import { OverlayBaseController } from '@ionic/angular/common';
33
import type { ActionSheetOptions } from '@ionic/core/components';
44
import { actionSheetController } from '@ionic/core/components';
5+
import { defineCustomElement } from '@ionic/core/components/ion-action-sheet.js';
56

67
@Injectable({
78
providedIn: 'root',
89
})
910
export class ActionSheetController extends OverlayBaseController<ActionSheetOptions, HTMLIonActionSheetElement> {
1011
constructor() {
1112
super(actionSheetController);
13+
defineCustomElement();
1214
}
1315
}

packages/angular/standalone/src/providers/alert-controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { Injectable } from '@angular/core';
22
import { OverlayBaseController } from '@ionic/angular/common';
33
import type { AlertOptions } from '@ionic/core/components';
44
import { alertController } from '@ionic/core/components';
5+
import { defineCustomElement } from '@ionic/core/components/ion-alert.js';
56

67
@Injectable({
78
providedIn: 'root',
89
})
910
export class AlertController extends OverlayBaseController<AlertOptions, HTMLIonAlertElement> {
1011
constructor() {
1112
super(alertController);
13+
defineCustomElement();
1214
}
1315
}

packages/angular/standalone/src/providers/loading-controller.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import { defineCustomElement } from '@ionic/core/components/ion-loading.js';
1010
export class LoadingController extends OverlayBaseController<LoadingOptions, HTMLIonLoadingElement> {
1111
constructor() {
1212
super(loadingController);
13-
14-
// TODO: FW-5415 may remove the need for this
1513
defineCustomElement();
1614
}
1715
}

packages/angular/standalone/src/providers/modal-controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Injector, Injectable, EnvironmentInjector, inject } from '@angular/core
22
import { AngularDelegate, OverlayBaseController } from '@ionic/angular/common';
33
import type { ModalOptions } from '@ionic/core/components';
44
import { modalController } from '@ionic/core/components';
5+
import { defineCustomElement } from '@ionic/core/components/ion-modal.js';
56

67
@Injectable()
78
export class ModalController extends OverlayBaseController<ModalOptions, HTMLIonModalElement> {
@@ -11,6 +12,7 @@ export class ModalController extends OverlayBaseController<ModalOptions, HTMLIon
1112

1213
constructor() {
1314
super(modalController);
15+
defineCustomElement();
1416
}
1517

1618
create(opts: ModalOptions): Promise<HTMLIonModalElement> {

packages/angular/standalone/src/providers/picker-controller.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import { defineCustomElement } from '@ionic/core/components/ion-picker.js';
1010
export class PickerController extends OverlayBaseController<PickerOptions, HTMLIonPickerElement> {
1111
constructor() {
1212
super(pickerController);
13-
14-
// TODO: FW-5415 may remove the need for this
1513
defineCustomElement();
1614
}
1715
}

packages/angular/standalone/src/providers/popover-controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Injector, inject, EnvironmentInjector } from '@angular/core';
22
import { AngularDelegate, OverlayBaseController } from '@ionic/angular/common';
33
import type { PopoverOptions } from '@ionic/core/components';
44
import { popoverController } from '@ionic/core/components';
5+
import { defineCustomElement } from '@ionic/core/components/ion-popover.js';
56

67
export class PopoverController extends OverlayBaseController<PopoverOptions, HTMLIonPopoverElement> {
78
private angularDelegate = inject(AngularDelegate);
@@ -10,6 +11,7 @@ export class PopoverController extends OverlayBaseController<PopoverOptions, HTM
1011

1112
constructor() {
1213
super(popoverController);
14+
defineCustomElement();
1315
}
1416

1517
create(opts: PopoverOptions): Promise<HTMLIonPopoverElement> {

packages/angular/standalone/src/providers/toast-controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { Injectable } from '@angular/core';
22
import { OverlayBaseController } from '@ionic/angular/common';
33
import type { ToastOptions } from '@ionic/core/components';
44
import { toastController } from '@ionic/core/components';
5+
import { defineCustomElement } from '@ionic/core/components/ion-toast.js';
56

67
@Injectable({
78
providedIn: 'root',
89
})
910
export class ToastController extends OverlayBaseController<ToastOptions, HTMLIonToastElement> {
1011
constructor() {
1112
super(toastController);
13+
defineCustomElement();
1214
}
1315
}

0 commit comments

Comments
 (0)