Bird
0
0

What is wrong with this NgModule definition?

medium📝 Debug Q7 of 15
Angular - Modules
What is wrong with this NgModule definition?
@NgModule({
  declarations: [AppComponent],
  bootstrap: AppComponent
})
export class AppModule {}
ANgModule must have <code>imports</code> defined
B<code>declarations</code> should be empty when using bootstrap
C<code>AppComponent</code> must be in <code>providers</code>
D<code>bootstrap</code> should be an array, not a single component
Step-by-Step Solution
Solution:
  1. Step 1: Check bootstrap property type

    The bootstrap property expects an array of components to bootstrap.
  2. Step 2: Identify the syntax error

    Providing a single component without array brackets causes an error.
  3. Final Answer:

    bootstrap should be an array, not a single component -> Option D
  4. Quick Check:

    Bootstrap must be an array of components [OK]
Quick Trick: Always wrap bootstrap components in an array [OK]
Common Mistakes:
  • Omitting brackets for bootstrap
  • Putting components in providers instead
  • Thinking imports are mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes