【发布时间】:2018-04-22 06:51:50
【问题描述】:
我正在更新一个在 Angular 4 中制作的项目。该网站由多个表单组成,其中包括输入字段。当用户按下“输入”时,表单正在提交。我想防止这种情况发生。我该怎么做?
我可以在引号内放置一些东西来阻止提交操作的发生:(keydown.enter)=""
form.component.html
<div class="d-flex justify-content-center hm-row">
<form class="hm-form" [formGroup]="crossingForm">
<div class="form-group">
<label for="dynamicThresholdTime">{{ 'CROSSING.DYNAMIC_THRESHOLD_TIME' | translate}}</label>
<input type="text" class="form-control" id="dynamicThresholdTime" placeholder="" formControlName="dynamicThresholdTime">
</div>
<...more code...>
</form>
</div>
【问题讨论】:
标签: html angular angular2-forms