我正在为我的angular 7项目编写测试用例,并收到以下错误失败:this.dialog.open不是函数
我的文件是:
test.service.ts
import { MatDialog } from '@angular/material/dialog';
import { SpinnerDialog } from './spinner.component';
constructor(public dialog: MatDialog) {}
dialogRef:any;
show() {
this.dialogRef = this.dialog.open(SpinnerDialog, {
disableClose: true,
panelClass: 'transparent-background'
});
}
test.component.ts
constructor(private test: TestService) { }
onSubmit() {
this.submitted = true;
this.test.show();
}