1
私はユーザーがページのメニューオプションを選択するとすぐに開くモーダルを持っています。私がいるIsueは、私はそれが私のngOnInit
角度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に に追加しましたか?
が、その既に存在