0
0
Angularframework~10 mins

RouterLink for navigation in Angular - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a RouterLink that navigates to the 'home' path.

Angular
<a [1]="'/home'">Home</a>
Drag options to blanks, or click blank then click option'
Anavigate
Bhref
ClinkTo
DrouterLink
Attempts:
3 left
💡 Hint
Common Mistakes
Using href instead of routerLink causes a full page reload.
Using linkTo or navigate are not valid Angular template attributes.
2fill in blank
medium

Complete the code to bind the RouterLink to a variable named 'path'.

Angular
<a [[1]]="path">Go</a>
Drag options to blanks, or click blank then click option'
ArouterLink
Bhref
CrouterLinkActive
Dlink
Attempts:
3 left
💡 Hint
Common Mistakes
Using href with binding syntax is incorrect.
routerLinkActive is for styling active links, not for navigation.
3fill in blank
hard

Fix the error in the RouterLink syntax to navigate to 'dashboard'.

Angular
<a routerLink=[1]>Dashboard</a>
Drag options to blanks, or click blank then click option'
A[dashboard]
Bdashboard
C'dashboard'
D"dashboard"
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes causes Angular to look for a variable named dashboard.
Using double quotes inside double quotes without escaping causes syntax errors.
4fill in blank
hard

Fill both blanks to create a RouterLink that navigates to 'profile' and applies the 'active' class when active.

Angular
<a [1]="'/profile'" [2]="'active'">Profile</a>
Drag options to blanks, or click blank then click option'
ArouterLink
Bhref
CrouterLinkActive
DclassActive
Attempts:
3 left
💡 Hint
Common Mistakes
Using href instead of routerLink breaks Angular routing.
Using classActive is not a valid Angular directive.
5fill in blank
hard

Fill all three blanks to create a RouterLink with a bound path, an active class, and a title attribute.

Angular
<a [[1]]="userPath" [2]="'selected'" title=[3]>User</a>
Drag options to blanks, or click blank then click option'
ArouterLink
BrouterLinkActive
C'User Profile'
Dhref
Attempts:
3 left
💡 Hint
Common Mistakes
Using href instead of routerLink breaks Angular routing.
Not quoting the title string causes errors.