You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.06 22:48:03