Browse Source

improvement(core): add debounce time input

pull/2215/head
thediaval 7 years ago
parent
commit
60f837e995
  1. 5
      npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts

5
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),
)

Loading…
Cancel
Save