feat(forms): AbstractControl to store raw validators in addition to combined validators function (#37881)
This commit refactors the way we store validators in AbstractControl-based classes: in addition to the combined validators function that we have, we also store the original list of validators. This is needed to have an ability to clean them up later at destroy time (currently it's problematic since they are combined in a single function). The change preserves backwards compatibility by making sure public APIs stay the same. The only public API update is the change to the `AbstractControl` class constructor to extend the set of possible types that it can accept and process (which should not be breaking). PR Close #37881
This commit is contained in:
8
goldens/public-api/forms/forms.d.ts
vendored
8
goldens/public-api/forms/forms.d.ts
vendored
@ -1,5 +1,6 @@
|
||||
export declare abstract class AbstractControl {
|
||||
asyncValidator: AsyncValidatorFn | null;
|
||||
get asyncValidator(): AsyncValidatorFn | null;
|
||||
set asyncValidator(asyncValidatorFn: AsyncValidatorFn | null);
|
||||
get dirty(): boolean;
|
||||
get disabled(): boolean;
|
||||
get enabled(): boolean;
|
||||
@ -15,10 +16,11 @@ export declare abstract class AbstractControl {
|
||||
get untouched(): boolean;
|
||||
get updateOn(): FormHooks;
|
||||
get valid(): boolean;
|
||||
validator: ValidatorFn | null;
|
||||
get validator(): ValidatorFn | null;
|
||||
set validator(validatorFn: ValidatorFn | null);
|
||||
readonly value: any;
|
||||
readonly valueChanges: Observable<any>;
|
||||
constructor(validator: ValidatorFn | null, asyncValidator: AsyncValidatorFn | null);
|
||||
constructor(validators: ValidatorFn | ValidatorFn[] | null, asyncValidators: AsyncValidatorFn | AsyncValidatorFn[] | null);
|
||||
clearAsyncValidators(): void;
|
||||
clearValidators(): void;
|
||||
disable(opts?: {
|
||||
|
Reference in New Issue
Block a user