Angular点击按钮打开含输入框弹窗,保存后值填充到多选下拉如何实现?
需求说明
点击按钮后触发弹窗打开,弹窗内包含输入字段,点击弹窗的保存按钮后,输入的值需要填充到多选下拉菜单中。
现有参考实现代码
TypeScript 代码
numList: any[]=[]; addnumber() { const dialogRef = this.dialog.open(NumberpopUpComponent, { width: "500px", disableClose:true }); dialogRef.afterClosed().subscribe((result) => { this.numList = this.NoList; // NoList 是弹窗组件内部的输入值列表 this.numList.push(result); }); }
HTML 代码
<button type="button" (click)="addnumber()"> Add Number </button>
内容的提问来源于stack exchange,提问作者User
相关产品推荐
相关产品推荐

