我正在使用Angular2 Cli构建Angular2应用程序。 我有角产生一个具有这样Angular 2提供的参数不匹配调用目标的任何签名(spec.ts)
constructor(private _elRef: ElementRef) {}
构造当我建(NPM开始)我得到这个错误
...angular2/tmp/broccoli_type_script_compiler-input_base_path-wKrIZXNv.tmp/0/src/app/notifications/notifications.component.spec.ts (10, 21): Supplied parameters do not match any signature of call target
文件notifications.component.spec.ts一个notifications.component cli是这样的
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { addProviders, async, inject } from '@angular/core/testing';
import { NotificationsComponent } from './notifications.component';
describe('Component: Notifications',() => {
it('should create an instance',() => {
let component = new NotificationsComponent();
expect(component).toBeTruthy();
});
});
但是,如果我没有构造参数构建一切工作正常。如果在构建之后添加此参数,则一切正常。
我缺少什么?
我注意到,但我试图提供一个参数,但任何不工作!你有什么建议? –
如果您的'NotificationsComponent'不需要'ElementRef',只需将它从构造函数中移除即可。否则,你可能想要检查你正在使用哪个测试框架,并为它提供一个存根。 –
我可以删除,但我想知道如何解决它! –