Q:

How to update/reset formBuilder attribute value?

Trying to set CURRENT_TEXT value to empty string "" every time function is called but it is always getting previous selected value , Any idea what has been implemented wrong ?
main.ts
constructor(private dataService: ApiService, private eventService: EventService, private formBuilder: FormBuilder) {
    this.questionForm = this.formBuilder.group({
        alrgyDetls: formBuilder.group({
            ALLERGY_DETAILS: ['']
        }),
        curntText: this.formBuilder.group({
            CURRENT_TEXT: ['']
        })
    });
}
formatSubQuestions(e: any) {
    const answerOption = [{
        "answerOptionId": 0,
        "answerText": "",
        "answerOptionId2": 0

    }];
    this.questionForm.currentText.patchValue({
        CURRENT_TEXT: " "
    });
    if (e) {
        answerOption[0].answerText = this.questionForm.get('curntText.CURRENT_TEXT').value || "";
    }
}
}

A:

Hi do you really want to have two formGroups inside the form, maybe instead you wanted to have two form controls.
But for your example you can do it the following way:
  formatSubQuestions(e: any) {
    const answerOption = [{
      "answerOptionId": 0,
      "answerText": "",
      "answerOptionId2": 0

    }];

    const formControl = this.questionForm.get('curntText').get('CURRENT_TEXT'); // get the wanted form control
    const oldValue = formControl.value; // save the old value before clearing it
    formControl.patchValue(''); // clear its value
    if (e) {
      answerOption[0].answerText = oldValue || '';
    }
  }

