RouterLinkActive

Stable

Directive

What it does

Lets you add a CSS class to an element when the link's route becomes active.

How to use

<a routerLink="/user/bob" routerLinkActive="active-link">Bob</a>

Class Overview

class RouterLinkActive implements OnChanges, , AfterContentInit {
constructor(router: Router, element: ElementRef, renderer: Renderer, cdr: ChangeDetectorRef)

links : QueryList<RouterLink>
linksWithHrefs : QueryList<RouterLinkWithHref>
routerLinkActiveOptions : {exact: boolean}
isActive : boolean
ngAfterContentInit() : void
routerLinkActive 
ngOnChanges(changes: SimpleChanges) : void
ngOnDestroy() : void

}

Selectors

[routerLinkActive]

Exported as

routerLinkActive

Class Description

Constructor

constructor(router: Router, element: ElementRef, renderer: Renderer, cdr: ChangeDetectorRef)

Class Details

exported from @angular/router/index, defined in @angular/router/src/directives/router_link_active.ts