Routing
Priority: P0 (CRITICAL)
Principles
- •Lazy Loading: Use
loadComponentfor standalone components andloadChildrenfor route files. - •Functional Guards: Use function-based guards (
CanActivateFn) instead of class-based guards (Deprecated). - •Component Inputs: Enable
withComponentInputBinding()to map route params directly to component inputs.
Guidelines
- •Title Strategy: Use
TitleStrategyservice to auto-set page titles from route data. - •Resolvers: Use
resolveto pre-fetch critical data before navigation completes, but avoid blocking UI for too long.
Anti-Patterns
- •Logic in Routes: Keep route definitions clean. Move logic to Guards or Resolvers.
- •Eager Loading features: Never direct import feature components in root routes.