Bird
0
0

Identify the error in this AppModule code:

medium📝 Debug Q14 of 15
Angular - Modules
Identify the error in this AppModule code:
@NgModule({
  declarations: AppComponent,
  imports: [BrowserModule],
  bootstrap: [AppComponent]
})
export class AppModule { }
Aimports should not include BrowserModule
Bdeclarations should be an array, not a single component
Cbootstrap should not be an array
DMissing import statement for AppComponent
Step-by-Step Solution
Solution:
  1. Step 1: Check declarations syntax

    Declarations must be an array of components, but here it is a single component without brackets.
  2. Step 2: Confirm other parts are correct

    Imports and bootstrap are correctly formatted; import statement is assumed present.
  3. Final Answer:

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

    Declarations require array syntax [OK]
Quick Trick: Declarations always use arrays [OK]
Common Mistakes:
  • Forgetting brackets around declarations
  • Confusing imports with declarations
  • Thinking bootstrap cannot be an array

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes