Bird
0
0

In Angular, where do you define child routes for a parent route?

easy🧠 Conceptual Q2 of 15
Angular - Routing
In Angular, where do you define child routes for a parent route?
AIn a separate routing module unrelated to the parent route.
BInside the children array property of the parent route object.
CDirectly inside the component's TypeScript file.
DWithin the app.module.ts bootstrap array.
Step-by-Step Solution
Solution:
  1. Step 1: Locate child routes in routing config

    Child routes are declared inside the parent route's children property in the routing configuration.
  2. Step 2: Eliminate incorrect options

    Options A, C, and D do not follow Angular routing patterns for child routes.
  3. Final Answer:

    Inside the children array property of the parent route object. -> Option B
  4. Quick Check:

    Child routes location = children array [OK]
Quick Trick: Child routes go inside the parent's children array [OK]
Common Mistakes:
MISTAKES
  • Defining child routes outside routing modules
  • Placing routes inside component files
  • Adding routes to bootstrap array

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes