From 60f837e995917d01275bc86ee12858da9dc65a2f Mon Sep 17 00:00:00 2001 From: thediaval Date: Tue, 19 Nov 2019 16:20:35 +0300 Subject: [PATCH] improvement(core): add debounce time input --- .../core/src/lib/directives/form-submit.directive.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts index 5d0c6ef7a1..4d6c1014db 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts @@ -21,6 +21,9 @@ type Controls = { [key: string]: FormControl } | FormGroup[]; selector: 'form[ngSubmit][formGroup]', }) export class FormSubmitDirective implements OnInit, OnDestroy { + @Input() + debounce = 200; + @Input() notValidateOnSubmit: string | boolean; @@ -42,7 +45,7 @@ export class FormSubmitDirective implements OnInit, OnDestroy { fromEvent(this.host.nativeElement as HTMLElement, 'keyup') .pipe( - debounceTime(200), + debounceTime(this.debounce), filter((key: KeyboardEvent) => key && key.key === 'Enter'), takeUntilDestroy(this), )