我遇到了使用路由器进行单元测试angular 2 RC4 app的问题。它给了我这个错误:
Can't bind to 'routerLink' since it isn't a known native property (" <p>Please Go to <a href="/">Home</a></p>
我已经实施了这样的测试:
beforeEach(() => {
addProviders([
FormBuilder,
disableDeprecatedForms(),
provideForms(),
HTTP_PROVIDERS,
APP_ROUTER_PROVIDERS,
ROUTER_DIRECTIVES
])
});
请帮助我完成这个过程。
答案 0 :(得分:0)
我解决了它通过做一些锻炼,这可能不是一个完美的解决方案,但我必须以任何方式做到这一点:
beforeEach(() => {
addProviders([
FormBuilder,
disableDeprecatedForms(),
provideForms(),
HTTP_PROVIDERS,
APP_ROUTER_PROVIDERS,
{provide: PLATFORM_DIRECTIVES, multi: true, useValue: ROUTER_DIRECTIVES}
])
});