title: Add active class to routerlink in angular 4
body: <p>I would like to add an active class when changing routes. 
  I have an  link in one component (home page) which redirects to other component (details page). </p>
  
  <pre><code>&lt;a routerLink="/dashboard/details" (click)="Clicked()"&lt;/a&gt;
  </code></pre>
  
  <p>Now when I return back from details page to home page, I want to have the a link to be active telling the users that this link has been clicked. </p>
  
  <p>I tried using <strong>routerLinkActive</strong>, but that doesn't seem to be working.</p>
  
  <p>html</p>
  
  <pre><code>&lt;a routerLink="/dashboard/details" routerLinkActive="active-link" (click)="Clicked()"&lt;/a&gt;
  </code></pre>
  
  <p>css</p>
  
  <pre><code>.active-link {
      color:red;
      font-weight: bold;
  }
  </code></pre>
  
  <p>Can anyone help me with this?</p>