【发布时间】:2019-08-13 09:47:18
【问题描述】:
我想在用户按下输入时发送我的表单我的输入失去焦点,但只有 1 次,因为如果我输入然后我改变焦点,我的事件将执行 2 次(1 用于输入,2 用于改变焦点)。
<form class="form-custom" #m="ngForm">
<div class="form-custom--input-btn">
<input #ofi="ngModel" type="text" class="clr-col-12 form-custom--input form-custom--input"
id="oficina" (keyup.enter)="hello()" (focusout)="hello()" name="oficina" [(ngModel)]="oficina" minlength="4" maxlength="4" [placeholder]="placeholderOficina" required>
<button type="button" class="btn--custom-over-input btn--custom-over-input--arrow" [disabled]="mult.invalid" (click)="hello()"></button>
</div>
</form>
我有我的输入 -> (keyup.enter)="hello()" (focusout)="hello()"
在我的按钮 (click)="hello()">
我需要 Angular 只获得 1 个事件或 (keyup.enter)="hello()" (focusout)="hello()"
【问题讨论】:
标签: angular