有一种方法可以使用引用字符串打开角度/材质对话框,如下所示:
this.dialog.open('randomComponent', {data: {element}});
组件必须在app.component.ts上定义,这有点明显
app.component应该是
@NgModule({
declarations: [
randomComponent
],
imports: [
...
]
],
entryComponents: [
randomComponent
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}