fix(angular): apply touch, dirty and pristine form control classes (#24558)

Resolves #24483
This commit is contained in:
Sean Perkins
2022-01-12 14:48:01 -05:00
committed by GitHub
parent 9a15753fd9
commit 273ae2cc08
4 changed files with 18 additions and 2 deletions

View File

@ -96,7 +96,7 @@ export class ValueAccessor implements ControlValueAccessor, AfterViewInit, OnDes
if (formControl) {
const methodsToPatch = ['markAsTouched', 'markAllAsTouched', 'markAsUntouched', 'markAsDirty', 'markAsPristine'];
methodsToPatch.forEach((method) => {
if (formControl.get(method)) {
if (typeof formControl[method] !== 'undefined') {
const oldFn = formControl[method].bind(formControl);
formControl[method] = (...params: any[]) => {
oldFn(...params);