Skip to content

Commit c53785c

Browse files
authored
fix(angular): warn devs that standalone components are not supported (#25516)
1 parent 5dfaf63 commit c53785c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

angular/src/directives/navigation/ion-router-outlet.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,25 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
233233
this.updateActivatedRouteProxy(cmpRef.instance, activatedRoute);
234234
} else {
235235
const snapshot = (activatedRoute as any)._futureSnapshot;
236+
236237
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
237238
const component = snapshot.routeConfig!.component as any;
239+
240+
/**
241+
* Angular 14 introduces a new `loadComponent` property to the route config,
242+
* that assigns the component to load to the `component` property of
243+
* the route snapshot. We can check for the presence of this property
244+
* to determine if the route is using standalone components.
245+
*
246+
* TODO: FW-1631: Remove this check when supporting standalone components
247+
*/
248+
if (component == null && snapshot.component) {
249+
console.warn(
250+
'[Ionic Warning]: Standalone components are not currently supported with ion-router-outlet. You can track this feature request at https://github.com/ionic-team/ionic-framework/issues/25404'
251+
);
252+
return;
253+
}
254+
238255
const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
239256

240257
// We create an activated route proxy object that will maintain future updates for this component

0 commit comments

Comments
 (0)