Skip to content

Commit 33200a9

Browse files
refactor(angular): use correct core instance for toast controller (#28493)
Issue number: N/A --------- ## What is the current behavior? As a takeaway from our learning session about a menuController bug in Ionic Angular, the team would like to update our other providers to use the same architecture as the menuController to prevent this kind of issue from happening again in the future. We also noticed that the common provider does not provide much value and it's easier to just have two separate implementations in `src` and `standalone`. (There wasn't much code we could de-duplicate) ## What is the new behavior? - Removed the common toast provider in favor of separate ones in src/standalone ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information
1 parent aeeb84b commit 33200a9

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

packages/angular/common/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export { AlertController } from './providers/alert-controller';
22
export { LoadingController } from './providers/loading-controller';
33
export { MenuController } from './providers/menu-controller';
44
export { PickerController } from './providers/picker-controller';
5-
export { ToastController } from './providers/toast-controller';
65

76
export { AnimationController } from './providers/animation-controller';
87
export { GestureController } from './providers/gesture-controller';

packages/angular/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export {
2323
AlertController,
2424
LoadingController,
2525
PickerController,
26-
ToastController,
2726
AnimationController,
2827
GestureController,
2928
DomController,
@@ -38,10 +37,11 @@ export {
3837
ViewDidEnter,
3938
ViewDidLeave,
4039
} from '@ionic/angular/common';
41-
export { ModalController } from './providers/modal-controller';
40+
export { ActionSheetController } from './providers/action-sheet-controller';
4241
export { MenuController } from './providers/menu-controller';
42+
export { ModalController } from './providers/modal-controller';
4343
export { PopoverController } from './providers/popover-controller';
44-
export { ActionSheetController } from './providers/action-sheet-controller';
44+
export { ToastController } from './providers/toast-controller';
4545

4646
// PACKAGE MODULE
4747
export { IonicModule } from './ionic-module';
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Injectable } from '@angular/core';
2+
import { OverlayBaseController } from '@ionic/angular/common';
3+
import type { ToastOptions } from '@ionic/core';
4+
import { toastController } from '@ionic/core';
5+
6+
@Injectable({
7+
providedIn: 'root',
8+
})
9+
export class ToastController extends OverlayBaseController<ToastOptions, HTMLIonToastElement> {
10+
constructor() {
11+
super(toastController);
12+
}
13+
}

packages/angular/standalone/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ export { IonRouterOutlet } from './navigation/router-outlet';
55
export { IonRouterLink, IonRouterLinkWithHref } from './navigation/router-link-delegate';
66
export { IonTabs } from './navigation/tabs';
77
export { provideIonicAngular } from './providers/ionic-angular';
8+
export { ActionSheetController } from './providers/action-sheet-controller';
89
export { MenuController } from './providers/menu-controller';
910
export { ModalController } from './providers/modal-controller';
1011
export { PopoverController } from './providers/popover-controller';
11-
export { ActionSheetController } from './providers/action-sheet-controller';
12+
export { ToastController } from './providers/toast-controller';
1213
export {
1314
AlertController,
1415
LoadingController,
1516
PickerController,
16-
ToastController,
1717
AnimationController,
1818
GestureController,
1919
DomController,

packages/angular/common/src/providers/toast-controller.ts renamed to packages/angular/standalone/src/providers/toast-controller.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { Injectable } from '@angular/core';
2+
import { OverlayBaseController } from '@ionic/angular/common';
23
import type { ToastOptions } from '@ionic/core/components';
34
import { toastController } from '@ionic/core/components';
45

5-
import { OverlayBaseController } from '../utils/overlay';
6-
76
@Injectable({
87
providedIn: 'root',
98
})

0 commit comments

Comments
 (0)