Bird
0
0

Which of these is the correct way to import RouterModule with routes in a feature module?

easy🧠 Conceptual Q2 of 15
Angular - Routing
Which of these is the correct way to import RouterModule with routes in a feature module?
ARouterModule.forChild(routes)
BRouterModule.withRoutes(routes)
CRouterModule.forRoot(routes)
DRouterModule.withChildren(routes)
Step-by-Step Solution
Solution:
  1. Step 1: Identify feature module routing method

    forChild is used to add routes in feature modules, not forRoot.
  2. Step 2: Eliminate incorrect methods

    withRoutes and withChildren do not exist in Angular Router API.
  3. Final Answer:

    RouterModule.forChild(routes) -> Option A
  4. Quick Check:

    Feature module routing = forChild [OK]
Quick Trick: Use forChild in feature modules, forRoot only once [OK]
Common Mistakes:
MISTAKES
  • Using forRoot multiple times
  • Using non-existent methods like withRoutes
  • Confusing forChild with forRoot

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes