Search code examples
angularangular2-testing

routerLinkActive directive causes undefined is not an object (evaluating 'router.events.subscribe')


I am using Angular2 RC3 and the new router. My HTML ...

<nav>
  <a [routerLink]="['/route1']" [routerLinkActive]="['active']">Route 1</a>
  <a [routerLink]="['/route2']" [routerLinkActive]="['active']">Route 2</a>
</nav>

routerLinkActive applies the 'active' class according to the selected link. Works great.

Problem is by adding [routerLinkActive] my unit tests now fail with ...

undefined is not an object (evaluating 'router.events.subscribe')

anyone got a fix for this?

many thanks


Solution

  • i put the tests on 'skip' in the end using Jasmine's xit

    This is no longer a problem on ng2 final release