How to set value of a form control which is inside a form array in Angular reactive form

Discussão em 'Angular' iniciado por Tanzeel, Abril 23, 2025.

  1. Tanzeel

    Tanzeel Guest

    I've a reactive form:

    this.leDetailsUpdateForm = new FormGroup({
    entityNameArray: new FormArray([
    new FormGroup({
    id: new FormControl(),
    entityName: new FormControl(),
    entityNameStartDate: new FormControl(), // <----- this i want to set
    entityNameEndDate: new FormControl(),
    entityNameStatus: new FormControl(),
    status: new FormControl(),
    }),
    ]),
    })


    I'm trying to set it after some calculations as follows :

    setStartDates(e: any) {
    console.log(e);
    this.leDetailsUpdateForm.get('entityNameArray').get('entityNameStartDate').setValue(e)
    }


    I'm not getting the required syntax on google. Please help.

    Continue reading...

Compartilhe esta Página