@studiohyperdrive/ngx-forms
Version:
An Angular package to help with complex forms and their validation.
12 lines (11 loc) • 643 B
TypeScript
import { FormGroup } from '@angular/forms';
/**
* FormGroup validator which checks if an array of controls in the control are filled in if the depended control is filled in
*
* @param controls - An array of controls.
* @param dependedControlKey - A control within the group which the other controls depend on.
* @param matchFunction - Optional function the dependedControl should check
*/
export declare const dependedRequiredValidator: <KeyType extends string = string>(controls: KeyType[], dependedControlKey: KeyType, matchFunction?: (data: any) => boolean) => (form: FormGroup) => {
hasDependedRequiredError: string[];
} | null;