va-input-repeated

The following examples exercise the various inputs.

Form controls within the array can be disabled – disabled controls cannot be removed by the user.

<va-input-repeated [placeholder]="'Placeholder'" [controlArray]="controlArray1" [tooltip]="'default validators'"></va-input-repeated>
<va-input-repeated [placeholder]="'Placeholder'" [maxFields]='3' [controlArray]="controlArray2" [tooltip]="'custom validators'" [errorMessages]="customErrorMessage" [itemErrorMessages]="customErrorMessage" [itemFactory]="emailControlFactory"></va-input-repeated>
class FormsInputRepeatedDocComponent {
    ...
    public customErrorMessage: ErrorMessagesMap = {
      'required': 'Its required!!!!',
      'maxlength': (err: any) => {
        return `Hey, thats way more than ${err.requiredLength}`;
      },
    };
    ...
    constructor(..., private fb: FormBuilder) {
        this.controlArray1 = this.fb.array([this.fb.control('')], arrayTruthyItemRequired());
        this.controlArray2 = this.fb.array([this.emailControlFactory()], Validators.compose([Validators.maxLength(3), arrayTruthyItemRequired()]));
    }
    ...
    emailControlFactory(): FormControl {
        return this.fb.control('', [Validators.email, Validators.required]);
    }
}