I have service and error-handler service, when I tried to invoke the dialog box code, it gives an error.
我有服务和错误处理程序服务,当我尝试调用对话框代码时,它会出错。
import { MdDialog, MdDialogRef } from '@angular/material';
import { HeaderDialog } from '../dialog-boxes.component';
export class MyService {
dialogRef: MdDialogRef<any>;
constructor(private dialog: MdDialog) {}
this.dialogRef = this.dialog.open(HeaderDialog, {
height: 'auto',
width: 'auto',
});
this.dialogRef.componentInstance.message = 'Hello';
this.dialogRef.afterClosed().subscribe(result => {
if (result) {}
this.dialogRef = null;
});
}
Unhandled Promise rejection: Error: Invalid providers for "HeaderDialog" - only instances of Provider and Type are allowed, got: [EConfig, Constants, ?undefined?, ...]
未处理的Promise拒绝:错误:“HeaderDialog”的提供程序无效 - 只允许Provider和Type的实例,得到:[EConfig,Constants,?undefined?,...]
1 个解决方案
#1
0
You should post your component HeaderDialog, in this component you have the problem.
您应该发布组件HeaderDialog,在此组件中您遇到问题。
#1
0
You should post your component HeaderDialog, in this component you have the problem.
您应该发布组件HeaderDialog,在此组件中您遇到问题。