From d9deedbce70d17ccdbd45c61fc4c5fe44b4e45e0 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 23 Aug 2022 18:40:24 +0300 Subject: [PATCH] Mark as "Deprecated" FormSubmitDirective --- .../core/src/lib/directives/form-submit.directive.ts | 9 ++++++++- 1 file changed, 8 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 3efbf3ca2d..f0cfc5e76b 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 @@ -14,7 +14,9 @@ import { debounceTime, filter } from 'rxjs/operators'; import { SubscriptionService } from '../services/subscription.service'; type Controls = { [key: string]: FormControl } | FormGroup[]; - +/** + * @deprecated FormSubmitDirective will be removed in V7.0.0. Use `ngSubmit` instead. + */ @Directive({ // eslint-disable-next-line @angular-eslint/directive-selector selector: 'form[ngSubmit][formGroup]', @@ -43,6 +45,7 @@ export class FormSubmitDirective implements OnInit { ngOnInit() { this.subscription.addOne(this.formGroupDirective.ngSubmit, () => { + if (this.markAsDirtyWhenSubmit) { this.markAsDirty(); } @@ -90,3 +93,7 @@ function setDirty(controls: Controls) { controls[key].updateValueAndValidity(); }); } +function Deprecated(arg0: string) { + throw new Error('Function not implemented.'); +} +