我正在尝试获取字段 Exchange 已填充为“HELLO”的表单。value
在 HTML 中使用不起作用,并且该字段显示为空白。
我尝试添加autocomplete=off
,但这也不起作用。
<div class="form-group">
<label for="AccountRef">Account Ref</label>
<div class="input-group">
<input type="text" id="accountref" name="accountref" [(ngModel)]="newAccount.accountRef">
<div class="input-group-append"></div>
</div>
<label for="Client">Client Name</label>
<div class="input-group">
<input type="text" id="client" name="client" [(ngModel)]="newAccount.client">
<div class="input-group-append"></div>
</div>
<label for="Exchange">Exchange</label>
<div class="input-group">
<input type="text" id="exchange" name="exchange" value ="HELLO" autocomplete="off" [(ngModel)]="newAccount.exchange">
<div class="input-group-append"></div>
</div>
</div>
由于您使用的是双向绑定,因此[(ngModel)]=newAccount.exchange
您需要使用 newAccout.exchange 填充值
所以在你的 ts/js 文件中给出默认值试试这个:newAccout.exchange="Hello"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句