【发布时间】:2019-10-19 22:38:58
【问题描述】:
当表单发布时,我想在角度 6 中获取 ngSelect 下拉列表中的选定项目名称和值。
我尝试使用 ngModel 和 templateVariable 获取它,但未返回选定名称,我只设法获取选定值。
<ng-select
name="testFunctionID"
[items]="testFunctions"
[multiple]="false"
bindLabel="name"
bindValue="testFunctionID"
[(ngModel)]="model.testFunctionID">
</ng-select>
对于下拉列表 {Mumbai :1}, {Pune: 2}, {Delhi: 3},如果我选择 Pune,那么我应该得到“Pune”以及“2”作为输出 json。
【问题讨论】: