【发布时间】:2019-08-06 23:06:06
【问题描述】:
在这种情况下,我使用的是响应式表单而不是 ngModel
我正在将插值写入输入文本字段
当我提交我的表单时,我会得到所有字段值,除了插值的值。 插值是空的
如何解决??
<label class="form-control-sm"
id="identificationCode"
name="identificationCode">{{reference.value + "-" + publishDate.value}}
</label>
<input #txtIdCode
type="text"
id="idCode"
name="idCode"
formControlName="txtIdCode"
maxlength="15"
value="{{reference.value + '-' + publishDate.value}}">
当我以这种方式获取 txtIdCode 时,我得到一个空值但输入文本被填充:
item.identificationCode = this.myForm.controls["txtIdCode"].value;
【问题讨论】:
标签: javascript html angular visual-studio-code