RouterLink class

Creates a listener on the target element that routes to a specified link.

<a routerLink="/heroes">Heroes</a>

Can also be used with RouterPath.

<a [routerLink]="heroPath.toUrl()">Heroes</a>

The routerLink can contain queryParameters or a fragment, ie: /heroes?a=1.

Annotations
  • @Directive(selector: '[routerLink]')

Constructors

Properties

@Input(), write-only
url → Url
read-only
visibleHref → String
Indicates the URL when the hovering on the link.
@HostBinding('attr.href'), read-only
hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

ngOnDestroy() → void
Executed before the directive is removed from the DOM and destroyed. [...]
onClick(MouseEvent event) → void
@HostListener('click')
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited