Bird
0
0

Why is it important that the root AppModule imports BrowserModule instead of CommonModule?

hard📝 Conceptual Q10 of 15
Angular - Modules
Why is it important that the root AppModule imports BrowserModule instead of CommonModule?
ACommonModule automatically bootstraps the app, which conflicts with AppModule.
BCommonModule is only for server-side rendering and cannot be used in root modules.
CBrowserModule is smaller and faster than CommonModule.
DBrowserModule includes services needed to launch and run the app in a browser, CommonModule does not.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the difference between BrowserModule and CommonModule

    BrowserModule provides essential services and directives for running Angular apps in browsers, including bootstrapping support.
  2. Step 2: Why CommonModule is not enough for root module

    CommonModule provides common directives but lacks the browser-specific services needed to launch the app.
  3. Final Answer:

    BrowserModule includes services needed to launch and run the app in a browser, CommonModule does not. -> Option D
  4. Quick Check:

    BrowserModule required for browser apps [OK]
Quick Trick: Root module must import BrowserModule, not CommonModule [OK]
Common Mistakes:
  • Using CommonModule in root module instead of BrowserModule
  • Thinking CommonModule includes bootstrap services
  • Confusing server and browser modules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes