我正在使用 Angular 6 和 Angular 材质。更新到最新版本后,控制台在开发中抛出此错误。在生产上它正在工作
Cannot read property 'ngMetadataName' of undefined
当我尝试通过服务打开材料对话框时会发生这种情况(没有服务,它们工作正常)。我认为它与注射剂有关,但我不确定。
版本:cli:6.1.5,核心:6.1.4,材料:6.4.6
这是日志堆栈:
CustomDialogComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Cannot read property 'ngMetadataName' of undefined
at injectArgs (core.js:1418)
at core.js:1491
at _callFactory (core.js:8438)
at _createProviderInstance (core.js:8396)
at resolveNgModuleDep (core.js:8371)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:9064)
at PortalInjector.push../node_modules/@angular/cdk/esm5/portal.es5.js.PortalInjector.get (portal.es5.js:732)
at resolveDep (core.js:9419)
at createClass (core.js:9309)
at createDirectiveInstance (core.js:9186)
任何帮助将不胜感激。
服务内的对话框,引发错误:
@Injectable({
providedIn: 'root'
})
export class customService {
constructor(private store: Store<RootState>, private dialog: MatDialog) {}
const dialogRef = this.dialog.open(customDialogComponent, {
width: '300px',
data: {
loading: false,
customId,
}
});