我正在使用 Angular2 Cli 构建 Angular2 应用程序。我有一个notifications.component,它有一个像这样的构造函数
constructor(private _elRef: ElementRef) {}
当我构建(npm start)时,出现此错误
...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
angular cli生成的文件notifications.component.spec.ts是这样的
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();
});
});
但是,如果我在没有构造函数参数的情况下构建一切正常。如果我在构建后添加此参数,则一切正常。
我错过了什么?