Please assist, I have nested form array, se below :
this.form = this.formBuilder.group({
projectTitle: [\'\', [Validators.required, Validators.maxLengt
Try something like this:
this.form = this.formBuilder.group({
projectTitle: ['', [Validators.required, Validators.maxLength(300)]],
projectDescription: ['', [Validators.required, Validators.maxLength(300)]],
funding: this.formBuilder.array([this._buildFundingItems({ items: null, amount: null })]),
});
_buildFundingItems(data): FormGroup {
if (!data) {
data = {
items: null,
amount: null
}
}
return this.formBuilder.group({
items: [data.items, [Validators.required, Validators.pattern(this.regexValidation.shortWordRegex)]],
amount: [data.amount, [Validators.required, Validators.pattern(this.regexValidation.amountTypeRegex)]],
})
}