src/app/app-routing.module.ts, registered via RouterModule.forRoot(...). There are exactly six top-level routes: one redirect, two lazy AuthGuard-protected feature modules (home, billing), and three eager auth pages (login, register, reset-password). Lazy children add their own forChild sub-routes.
This page covers the route table, lazy loading, and preloading only. The guard/interceptor/token mechanics are on , and how the shell hosts .
Auth: Guard, Interceptor & AuthService
the authentication page
<router-outlet> is on App Shell, Bootstrap & Structure
the overview page
The route table
src/app/app-routing.module.ts
| Path | Kind | Component / Module | Guard | Notes |
|---|---|---|---|---|
'' | Redirect (pathMatch: 'full') | → /home | none | Empty URL bounces to the dashboard; the guard on /home then gates it. |
home | Lazy (loadChildren) | HomeModule → HomeComponent | AuthGuard | The entire authenticated UI (map, fleet, missions, video). |
billing | Lazy (loadChildren) | BillingModule → BillingPageComponent | AuthGuard | Has '' / success / cancel children (see below). |
login | Eager (component) | LoginComponent | none | Reads ?register=true to toggle the register hint. |
register | Eager (component) | RegisterComponent | none | Requests a verification email, then routes to /login. |
reset-password | Eager (component) | ResetPasswordComponent | none | Reads ?token and ?verify=true query params. |
isaac-sim | Commented out | (IsaacSimPageComponent) | (AuthGuard) | Route is disabled in source; see the gotcha below. |
AppModule (src/app/app.module.ts) so they load in the initial bundle — a user hitting /login cold must not wait on a lazy chunk. Note that RegisterComponent physically lives under src/app/home/register/ but is declared in AppModule and routed eagerly — a location/ownership mismatch worth preserving awareness of.
Lazy modules and child routes
Bothhome and billing use loadChildren so they are compiled into separate code-split chunks. Each defines its own forChild routing module:
- home
- billing
src/app/home/home-routing.module.ts
HomeComponent — the composition root of the authenticated UI. HomeModule also declares the two navigation surfaces (MenuMainComponent, MenuTopLeftComponent) and ~50 dialog/child components, so those live only inside the home chunk and cannot be reused on /login or /billing without re-declaration.PreloadAllModules — “lazy” but eagerly downloaded
The router is configured withpreloadingStrategy: PreloadAllModules. This is the single most important behavioral fact on this page:
Lazy loading here buys build-time code splitting (smaller individual chunks, better caching granularity, and enforced module boundaries), not runtime deferral. anchorScrolling: 'enabled' is the only other router option set.
Route guards
home and billing both carry canActivate: [AuthGuard]. The guard (src/app/auth/auth.guard.ts) awaits AuthService.isAuthenticated() and, on failure, calls router.navigate(['/login']):
src/app/auth/auth.guard.ts:14
Double redirect to .
/login. AuthService.isAuthenticated() also navigates to /login itself when the token is missing/invalid (src/app/auth/auth.service.ts), and then the guard navigates again. Both fire on an unauthenticated hit to a protected route. The catch branch above, however, returns false without navigating — so a thrown error blocks the route but leaves the user on a blank outlet. Full token mechanics are on Auth: Guard, Interceptor & AuthService
the authentication page
Gotcha: there is no 404 route
There is no wildcard** route in the table. An unknown URL matches nothing and the router renders an empty <router-outlet> — a blank page with no error, no redirect, and no “not found” UI.
Gotcha: Isaac Sim is a half-wired dead route
The/isaac-sim route is commented out in app-routing.module.ts (both the import and the route entry), yet MenuMainComponent still calls this.router.navigate(['/isaac-sim']) (src/app/menu-main/menu-main.component.ts:168), gated behind the environment.enableIsaacSim feature flag. With the route disabled, that navigation matches nothing and — per the missing-404 behavior above — lands on a blank outlet. IsaacSimPageComponent itself is still declared in HomeModule. To actually enable the page, uncomment both the import and the route (it already carries canActivate: [AuthGuard]).
Adding or changing a route
Decide eager vs lazy
Auth/entry pages that must render before the app is authenticated go in
AppModule and are wired as { path, component } (eager). Anything else should be its own NgModule loaded with loadChildren. Remember PreloadAllModules means “lazy” chunks still download up front.Add the top-level entry
Edit the
routes array in src/app/app-routing.module.ts. Add canActivate: [AuthGuard] if the page requires login (like home and billing).Add child routes for a lazy module
Create a
*-routing.module.ts using RouterModule.forChild(...) and import it into the feature module (mirror home-routing.module.ts / billing-routing.module.ts). Use static route data to parameterize a shared component, as billing does for success/cancel.Wire any navigation
In-app navigation is driven by for the menu surfaces.
router.navigate([...]) calls (e.g. MenuMainComponent → /billing, LoginComponent → /home), not routerLink in most cases. Add the corresponding call where the UI triggers it. See App Shell, Bootstrap & Structure
the overview
Related notes
App Shell, Bootstrap & Structure
main.ts → AppModule → AppComponent bootstrap, global chrome, and where
<router-outlet> sits.Auth: Guard, Interceptor & AuthService
AuthGuard, the Bearer interceptor, token refresh, and the double-redirect detail.Environments, Build & CI
angular.json build configs, environment.enableIsaacSim, and the service-worker flag.Drone Fleet Management
What the lazy
/home route actually renders once past the guard.Service worker caveat (build/PWA, not routing). .
angular.json sets serviceWorker: true for production/aws-dev/e2e builds with ngsw-config.json, but AppModule does not import ServiceWorkerModule.register('ngsw-worker.js'). If you rely on SW-cached routes surviving offline navigation, verify the worker is actually registered. Details on Environments, Build & CI
the build page

