mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
chore(): sync with main
This commit is contained in:
@ -89,6 +89,7 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
|
||||
private config: Config,
|
||||
private navCtrl: NavController,
|
||||
@Optional() private environmentInjector: EnvironmentInjector,
|
||||
@Optional() private componentFactoryResolver: ComponentFactoryResolver,
|
||||
commonLocation: Location,
|
||||
elementRef: ElementRef,
|
||||
router: Router,
|
||||
@ -232,8 +233,25 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
|
||||
this.updateActivatedRouteProxy(cmpRef.instance, activatedRoute);
|
||||
} else {
|
||||
const snapshot = (activatedRoute as any)._futureSnapshot;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const component = snapshot.routeConfig!.component as any;
|
||||
|
||||
/**
|
||||
* Angular 14 introduces a new `loadComponent` property to the route config,
|
||||
* that assigns the component to load to the `component` property of
|
||||
* the route snapshot. We can check for the presence of this property
|
||||
* to determine if the route is using standalone components.
|
||||
*
|
||||
* TODO: FW-1631: Remove this check when supporting standalone components
|
||||
*/
|
||||
if (component == null && snapshot.component) {
|
||||
console.warn(
|
||||
'[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'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
|
||||
|
||||
// We create an activated route proxy object that will maintain future updates for this component
|
||||
@ -243,6 +261,12 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
|
||||
|
||||
const injector = new OutletInjector(activatedRouteProxy, childContexts, this.location.injector);
|
||||
|
||||
/**
|
||||
* The resolver is not always provided and is required in Angular 12.
|
||||
* Fallback to the class-level provider when the resolver is not set.
|
||||
*/
|
||||
resolverOrInjector = resolverOrInjector || this.componentFactoryResolver;
|
||||
|
||||
if (resolverOrInjector && isComponentFactoryResolver(resolverOrInjector)) {
|
||||
// Backwards compatibility for Angular 13 and lower
|
||||
const factory = resolverOrInjector.resolveComponentFactory(component);
|
||||
|
Reference in New Issue
Block a user