mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs: update first-app-lesson-11.md to include info about routerLink (#50348)
Add info about importing RouterLink and RouterOutlet. The existing document results in an error. The error indicates that the anchor element doesn't have the binding property for routerLink. The corresponding module (RouterModule) should be imported in the component template. Add description for RouterModule in housing-location component The description is added to fix the issue with the anchor element tag binding. PR Close #50348
This commit is contained in:
@@ -43,6 +43,8 @@ In this case, `:id` is dynamic and will change based on how the route is request
|
||||
<code-example header="Add anchor with a routerLink directive to housing-location.component.ts" path="first-app-lesson-11/src/app/housing-location/housing-location.component.ts" region="add-router-link"></code-example>
|
||||
|
||||
The `routerLink` directive enables Angular's router to create dynamic links in the application. The value assigned to the `routerLink` is an array with two entries: the static portion of the path and the dynamic data.
|
||||
|
||||
For the routerLink to work in the template, add a file level import of RouterLink and RouterOutlet from '@angular/router', then update the component imports array to include both RouterLink and RouterOutlet
|
||||
|
||||
1. At this point you can confirm that the routing is working in your app. In the browser, refresh the home page and click the "learn more" button for a housing location.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user