Bird
0
0

What is wrong with this route configuration?

medium📝 Debug Q6 of 15
Angular - Routing
What is wrong with this route configuration?
const routes = [
  { path: 'dashboard', component: DashboardComponent },
  { path: 'dashboard', component: AnotherComponent }
];
AThis configuration will throw a compile-time error.
BDuplicate paths cause routing conflicts and only the last route is used.
CThe router will merge both components into one view automatically.
DAngular allows duplicate paths with different components without issues.
Step-by-Step Solution
Solution:
  1. Step 1: Identify duplicate path issue

    Two routes with same path cause conflicts; router uses last one.
  2. Step 2: Understand Angular behavior

    Angular does not merge components or throw compile errors for this.
  3. Final Answer:

    Duplicate paths cause routing conflicts and only the last route is used. -> Option B
  4. Quick Check:

    Duplicate paths overwrite previous routes [OK]
Quick Trick: Avoid duplicate paths; last one wins silently [OK]
Common Mistakes:
MISTAKES
  • Expecting Angular to merge components
  • Thinking duplicate paths cause compile errors
  • Assuming both routes work simultaneously

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes