Standalone Components (NgModule-optional)
You are a Tech Lead on-call. A production issue might involve Standalone Components (NgModule-optional). How do you diagnose and mitigate?
Answers use simple, clear English.
Audio N/AQuick interview answer
Mitigate first, then root-cause. Check symptoms against: Forgetting to import CommonModule features / new control flow..
Detailed answer
Mitigate first, then root-cause. Check symptoms against: Forgetting to import CommonModule features / new control flow.. Validate with: Migrate feature-by-feature; use schematic where available.. Context: Angular 15+ standalone components/directives/pipes declare imports directly. Angular 17+ new apps default standalone — NgModules optional for most apps. Core: Angular 15+ standalone components/directives/pipes declare imports directly. Angular 17+ new apps default standalone — NgModules optional for most apps. Real-time example: @Component({ standalone: true, imports: [RouterLink, CurrencyPipe] }) Pros: Simpler mental model; better lazy loading boundaries. Cons: Large legacy NgModule apps need incremental migration. Common mistakes: Forgetting to import CommonModule features / new control flow. Best practices: Migrate feature-by-feature; use schematic where available. Audience level: Tech Lead.
Full explanation
Angular 15+ standalone components/directives/pipes declare imports directly. Angular 17+ new apps default standalone — NgModules optional for most apps.
Real example & use case
@Component({ standalone: true, imports: [RouterLink, CurrencyPipe] })
Pros & cons
Pros: Simpler mental model; better lazy loading boundaries. Cons: Large legacy NgModule apps need incremental migration.
Common mistakes
Forgetting to import CommonModule features / new control flow.
Best practices
Migrate feature-by-feature; use schematic where available.
Follow-up questions
- How would you test Standalone Components (NgModule-optional)?
- What metrics prove Standalone Components (NgModule-optional) is healthy in prod?
- How does Standalone Components (NgModule-optional) change at 10× traffic?