Bird
0
0

What is wrong with this Angular module code?

medium📝 Debug Q14 of 15
Angular - Modules
What is wrong with this Angular module code?
@NgModule({ declarations: [CompA], imports: [BrowserModule, FeatureModule] }) export class AppModule {}
ANgModule decorator is missing
BDeclarations array cannot include components
CBrowserModule should only be imported once in the root module
DFeatureModule cannot be imported inside AppModule
Step-by-Step Solution
Solution:
  1. Step 1: Check BrowserModule usage

    BrowserModule must be imported only once in the root module to avoid errors.
  2. Step 2: Verify other parts

    Declarations can include components, FeatureModule can be imported, and @NgModule is present.
  3. Final Answer:

    BrowserModule should only be imported once in the root module -> Option C
  4. Quick Check:

    BrowserModule single import rule [OK]
Quick Trick: Import BrowserModule only once in root module [OK]
Common Mistakes:
  • Importing BrowserModule in multiple modules
  • Thinking declarations cannot have components
  • Assuming FeatureModule import is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes