diff --git a/packages/angular/test/base/src/app/app-landing/app-landing.component.ts b/packages/angular/test/base/src/app/app-landing/app-landing.component.ts index 62814291cdd..ca9dd14dfb7 100644 --- a/packages/angular/test/base/src/app/app-landing/app-landing.component.ts +++ b/packages/angular/test/base/src/app/app-landing/app-landing.component.ts @@ -1,9 +1,16 @@ import { Component, VERSION } from '@angular/core'; +import { RouterLink } from '@angular/router'; +import { IonContent, IonHeader, IonItem, IonLabel, IonList, IonRouterLink, IonTitle, IonToolbar } from '@ionic/angular'; +/** + * Only the standalone bootstrap renders this page, so it can't rely on + * AppModule's IonicModule scope. These imports register the custom elements. + */ @Component({ selector: 'app-landing', templateUrl: './app-landing.component.html', - standalone: false + standalone: true, + imports: [RouterLink, IonRouterLink, IonContent, IonHeader, IonItem, IonLabel, IonList, IonTitle, IonToolbar], }) export class AppLandingComponent { angularVersion = VERSION; diff --git a/packages/angular/test/base/src/app/app.module.ts b/packages/angular/test/base/src/app/app.module.ts index fab99611619..eed9913e73e 100644 --- a/packages/angular/test/base/src/app/app.module.ts +++ b/packages/angular/test/base/src/app/app.module.ts @@ -4,7 +4,6 @@ import { RouteReuseStrategy } from '@angular/router'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular/lazy'; import { AppComponent } from './app.component'; import { AppRoutingModule } from './app-routing.module'; -import { AppLandingComponent } from './app-landing/app-landing.component'; import { ModeSwitcherComponent } from './mode-switcher.component'; const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; @@ -15,7 +14,7 @@ export function ionicConfigFactory(): any { } @NgModule({ - declarations: [AppComponent, AppLandingComponent], + declarations: [AppComponent], imports: [ BrowserModule, AppRoutingModule, diff --git a/packages/angular/test/base/src/app/app.routes.ts b/packages/angular/test/base/src/app/app.routes.ts index 291e96540de..ee513805d80 100644 --- a/packages/angular/test/base/src/app/app.routes.ts +++ b/packages/angular/test/base/src/app/app.routes.ts @@ -1,11 +1,15 @@ import { Routes } from '@angular/router'; -import { AppLandingComponent } from './app-landing/app-landing.component'; export const routes: Routes = [ + /** + * Has to load lazily. The lazy app bootstraps from this same route table, and + * eagerly pulling in a standalone component races its custom element + * registration against the lazy loader's. + */ { path: '', pathMatch: 'full', - component: AppLandingComponent + loadComponent: () => import('./app-landing/app-landing.component').then(c => c.AppLandingComponent) }, { path: 'lazy',