4

I am trying to use isRouteActive for determining if the particular route is active or not, but getting error, angular2.dev.js:23730 TypeError: l_context.isRouteActive is not a function

<li [class.active]="isRouteActive(router.generate(['/Users']))"><a [routerLink]="['Users']">Users </a></li>

I have gone through the documentation, & surprised why there are two different documents for Router class.

https://angular.io/docs/ts/latest/api/router/index/Router-class.html https://angular.io/docs/ts/latest/api/router/Router-class.html

I am using 2.0.0-beta.12 version of Angular2.

It seems isRouteActive is not available in 2.0.0-beta.12. But I am unable to figure out how to achieve the same.

Rahul Bhooteshwar
  • 1,675
  • 17
  • 31
  • Please edit the question and add the code there. Code in comments is hard to read. Do you inject the `Router` how does your `isRouteActive()` method look like? – Günter Zöchbauer May 04 '16 at 04:00
  • Thank you for your response Günter Zöchbauer. It reminded me about the typo in my code. I have answered my question for the future reference. Thank You again. – Rahul Bhooteshwar May 04 '16 at 04:22