Bird
0
0

Identify the error in this route config:

medium📝 Debug Q14 of 15
Angular - Routing
Identify the error in this route config:
{ path: 'home', component: HomeComponent, children: { path: 'profile', component: ProfileComponent } }
A'children' should be an array, not an object
BMissing component for 'home' route
C'path' cannot be used inside children
DProfileComponent must be declared in AppModule
Step-by-Step Solution
Solution:
  1. Step 1: Check 'children' property type

    The 'children' property must be an array of route objects, not a single object.
  2. Step 2: Verify given config

    Here, 'children' is incorrectly assigned an object instead of an array.
  3. Final Answer:

    'children' should be an array, not an object -> Option A
  4. Quick Check:

    'children' = array of routes [OK]
Quick Trick: 'children' must always be an array, not a single object [OK]
Common Mistakes:
MISTAKES
  • Using object instead of array for children
  • Confusing 'path' usage inside children
  • Assuming missing component causes this error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes