top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the use for RoluterLinkActive in Angular Routes (2,4,5) ?

0 votes
296 views
What is the use for RoluterLinkActive in Angular Routes (2,4,5) ?
posted Dec 16, 2017 by Manish Tiwari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In Angular(2/4/5), Router Link Active is used to identify whether a route is active or not. Based on this we can control the CSS class

Example:

<ul class="nav navbar-nav">
  <li><a routerLink="/" routerLinkActive="menu-active">Home</a></li>
  <li><a routerLink="/about" routerLinkActive="menu-active" >About</a></li>
  <li><a routerLink="/contact" routerLinkActive="menu-active" >Contact</a></li>
</ul>

In Above example will add the menu-active class if the route found in routerLink matches the current route.

answer Dec 26, 2017 by Madhavi Latha
...