Angular 6-表单-选择选项无法正确更新

时间:2019-03-12 12:24:17

标签: javascript angular typescript angular-ngmodel

有人可以告诉我,为什么选择选项无法正确更新。但是无论我进行了什么更改,控制台都能获得适当的价值。

具有带有选择选项和保存按钮的表格。每当我更改时,它在我的视图中显示为[0] [0]-[0] [0]。请complete code is here

form name="form" (ngSubmit)="onSubmit()" #f="ngForm" novalidate>
    <div class="form-group" contenteditable="false" *ngFor="let val of mockData">
        <p>{{val.description}}</p>
        <label for="sort" class="col-sm-2 control-label"> select current type </label>
        <div class="col-sm-4">
            <select [(ngModel)]="saveData.selectedValue1" (change)="currChanged()" name="selectedValue1" >
                <option *ngFor='let d of dropDownString' [value]="d.currencyType">
{{d.currencyType}}
</option>
            </select>
        </div>
        <label for="sort" class="col-sm-2 control-label"> select max rate </label>
        <div class="col-sm-4">
            <select [(ngModel)]="saveData.selectedValue2" (change)="rateChanged()" name="selectedValue2" #selectedValue2 = "ngModel">
                <option *ngFor='let c of currencyValue' [value]="c.maxRate">
{{c.maxRate}}
</option>
            </select>
        </div>
    </div>
    <button>Save</button>
</form>

哪里出错了,什么地方要改变。

注意:我只想单独保存选择选项值,并且应该在获取响应时不做任何更改的描述。暂时正在使用一些硬编码数据。

预先感谢

0 个答案:

没有答案
相关问题