我正在尝试获取一个表单,其中Exchange字段已填充为"HELLO“。在超文本标记语言中使用value
不起作用,该字段显示为空。
我尝试添加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>
发布于 2019-04-23 02:44:32
由于您使用的是双向绑定[(ngModel)]=newAccount.exchange
,因此需要使用newAccout.exchange填充值
所以在ts/js文件中给出默认值,试试这个:newAccout.exchange="Hello"
发布于 2019-04-23 02:45:27
这对我很有效。尝试其他浏览器或更好的集成开发环境-Sublime、Webstorm、Visual Code等。
https://stackoverflow.com/questions/55799377
复制相似问题