按下回车,我提交了一份表格。但是当我按回车键时,表单已提交但验证程序未运行
<form [ngFormModel]="form" (keyup.enter)="updateApplicationLink()">
<input [(ngModel)]="table.labelFR" ngControl="labelfr">
constructor(fb: FormBuilder) {
this.form= fb.group({
labelfr: new Control('', Validators.required)
});
答案 0 :(得分:1)
尝试此操作以进行必要的验证:
<input ng-model="labelFR" required>
<h1>{{form.labelFR.$valid}}</h1>