import { FormGroup, FormArray, AbstractControl } from '@angular/forms';
|
import { Injectable } from '@angular/core';
|
|
@Injectable()
|
export class ToolsService {
|
public static markAsDirty(controlSet:FormGroup|FormArray){
|
const controls = controlSet.controls;
|
Object.values(controls).forEach(
|
(control:AbstractControl) => {
|
if(control instanceof FormGroup || control instanceof FormArray){
|
ToolsService.markAsDirty(control);
|
}else{
|
control.markAsDirty();
|
}
|
}
|
)
|
}
|
}
|