Sha*_*kov 5 input typescript angular-material angular
我有一个组件基本上看起来像
export class MyComponent{
@Input() inp: string;
}
Run Code Online (Sandbox Code Playgroud)
我有另一个使用材质对话框的组件,如下所示:
export class MyParentComponent{
openDialog(): void {
let dialogRef = this.dialog.open(MyComponent);
}
Run Code Online (Sandbox Code Playgroud)
我想知道如何将 @input 参数传递给 MyComponent。我能想到的唯一解决方案是用另一个组件包装 MyComponent,该组件通过 html 向其发送输入参数,并使用这个新组件作为“open”的参数。有没有其他好的解决方案,我不必创建另一个组件?
| 归档时间: |
|
| 查看次数: |
1229 次 |
| 最近记录: |