简体   繁体   English

routerLinkActive指令导致undefined不是对象(评估“ router.events.subscribe”)

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

I am using Angular2 RC3 and the new router. 我正在使用Angular2 RC3和新路由器。 My HTML ... 我的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. routerLinkActive根据所选链接应用“活动”类。 Works great. 效果很好。

Problem is by adding [routerLinkActive] my unit tests now fail with ... 问题是通过添加[routerLinkActive]我的单元测试现在失败,并显示...

undefined is not an object (evaluating 'router.events.subscribe') 未定义不是对象(评估“ router.events.subscribe”)

anyone got a fix for this? 有人为此解决了吗?

many thanks 非常感谢

i put the tests on 'skip' in the end using Jasmine's xit 我最终使用Jasmine的xit对测试进行了“跳过”

This is no longer a problem on ng2 final release ng2最终版本不再是问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM