1
我有一个模式,只要用户选择页面的菜单选项,即可打开。我遇到Isue的是,我对如何得到它打电话给我的函数调用在我ngOnInit
Angular 2 - 茉莉花测试 - 打开模式在页面加载
test.component.ts不知道
constructor(public dialog: MdDialog) { }
ngOnInit() {
this.openTestModal();
}
openTestModal() {
this.dialog.open(TestModalComponent, {
disableClose: true,
width: '600px'
});
}
我已导入我的模型组件,并试图:
变化password.component.spec.ts
import { TestModalComponent } from '../test-modal/test-modal.component';
spyOn(component, 'openTestModal');
spyOn(component, 'ngOnInit').and.callThrough();
it('should be created',() => {
expect(component).toBeTruthy();
});
错误
找不到TestComponent的组件工厂。你把它添加到 @ NgModule.entryComponents?
但它已经在那里