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)

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

}

Selectors

[routerLinkActive]

Exported as

routerLinkActive

Class Description

Constructor

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

Class Details

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