Bird
0
0

Which of the following is the correct way to define a route for path 'home' with component HomeComponent?

easy📝 Syntax Q12 of 15
Angular - Routing
Which of the following is the correct way to define a route for path 'home' with component HomeComponent?
A{ path: 'home', component: HomeComponent }
B{ path: 'home', redirectTo: HomeComponent }
C{ route: 'home', component: HomeComponent }
D{ path: 'home', component: 'HomeComponent' }
Step-by-Step Solution
Solution:
  1. Step 1: Check correct property names

    The route object must have path and component properties.
  2. Step 2: Verify component value type

    The component value should be the component class, not a string or redirect.
  3. Final Answer:

    { path: 'home', component: HomeComponent } -> Option A
  4. Quick Check:

    Use path and component keys correctly [OK]
Quick Trick: Use component class, not string or redirectTo for components [OK]
Common Mistakes:
MISTAKES
  • Using 'route' instead of 'path'
  • Setting component as a string
  • Using redirectTo instead of component for components

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes