Skip to content

Update navigate-to-routes.md to include RouterLink in imports. #61965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions adev/src/content/guide/routing/navigate-to-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ The RouterLink directive is Angular's declarative approach to navigation. It all
## How to use RouterLink

Instead of using regular anchor elements `<a>` with an `href` attribute, you add a RouterLink directive with the appropriate path in order to leverage Angular routing.

```angular-html
<nav>
<a routerLink="/user-profile">User profile</a>
<a routerLink="/settings">Settings</a>
</nav>
```angular-ts
import {RouterLink} from '@angular/router';
@Component({
template: `
<nav>
<a routerLink="/user-profile">User profile</a>
<a routerLink="/settings">Settings</a>
</nav>
`
imports: [RouterLink],
...
})
export class App {}
```

### Using absolute or relative links
Expand Down
Loading