Challenge - 5 Problems
RouterLink Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What happens when RouterLink is used incorrectly?
Consider this Angular template snippet:
What will be the result when this link is clicked?
<a routerLink="['/home']">Home</a>
What will be the result when this link is clicked?
Angular
<a routerLink="['/home']">Home</a>Attempts:
2 left
💡 Hint
RouterLink can accept both strings and arrays for navigation paths.
✗ Incorrect
In Angular, routerLink can be used with a string or an array of path segments. Using an array like ['/home'] is valid and navigates correctly.
📝 Syntax
intermediate2:00remaining
Which RouterLink syntax correctly navigates to a child route?
You want to navigate to the child route '/products/details'. Which RouterLink syntax is correct?
Attempts:
2 left
💡 Hint
RouterLink array syntax splits path segments by commas.
✗ Incorrect
Using an array with separate segments like ['/products', 'details'] correctly navigates to the child route. The string '/products/details' also works but must be quoted properly.
🔧 Debug
advanced2:00remaining
Why does this RouterLink not navigate as expected?
Given this template:
Clicking the link does not navigate. What is the likely cause?
<a [routerLink]="['/dashboard']">Dashboard</a>
Clicking the link does not navigate. What is the likely cause?
Angular
<a [routerLink]="['/dashboard']">Dashboard</a>Attempts:
2 left
💡 Hint
RouterLink needs RouterModule to work properly.
✗ Incorrect
If RouterModule is not imported in the Angular module, routerLink directives won't function and clicking links won't navigate.
❓ state_output
advanced2:00remaining
What is the value of the href attribute rendered by RouterLink?
Given this Angular template:
and userId = 42, what is the href attribute value in the rendered HTML?
<a [routerLink]="['/profile', userId]">Profile</a>
and userId = 42, what is the href attribute value in the rendered HTML?
Angular
userId = 42Attempts:
2 left
💡 Hint
RouterLink builds the URL by joining path segments.
✗ Incorrect
RouterLink joins the array segments into a path, so ['/profile', 42] becomes '/profile/42' in the href attribute.
🧠 Conceptual
expert3:00remaining
Which statement about RouterLink and accessibility is true?
Select the correct statement about using RouterLink for navigation and accessibility best practices.
Attempts:
2 left
💡 Hint
Think about how native tags behave with keyboard and screen readers.
✗ Incorrect