Bird
0
0

You want to create a nested route where navigating to '/account' shows AccountComponent and '/account/profile' shows ProfileComponent inside AccountComponent. How should you configure the routes?

hard🚀 Application Q8 of 15
Angular - Routing
You want to create a nested route where navigating to '/account' shows AccountComponent and '/account/profile' shows ProfileComponent inside AccountComponent. How should you configure the routes?
ADefine 'account' route with AccountComponent and children array containing 'profile' route with ProfileComponent.
BDefine separate routes for 'account' and 'account/profile' at root level without children.
CUse lazy loading for 'profile' route only.
DSet 'profile' as a sibling route to 'account' with redirect.
Step-by-Step Solution
Solution:
  1. Step 1: Understand nested routing goal

    To render ProfileComponent inside AccountComponent, 'profile' must be a child route of 'account'.
  2. Step 2: Configure routes accordingly

    Define 'account' route with AccountComponent and a children array including 'profile' route with ProfileComponent.
  3. Final Answer:

    Define 'account' route with AccountComponent and children array containing 'profile' route with ProfileComponent. -> Option A
  4. Quick Check:

    Nested routes use children array under parent route [OK]
Quick Trick: Child routes render inside parent component's router outlet [OK]
Common Mistakes:
MISTAKES
  • Defining nested routes as siblings
  • Not using children array for nesting
  • Confusing lazy loading with nested routing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes