Radio button returning previous value selected

Viewed 29

The below function is called on click of a radio button:

  this.selectedMeasures.forEach(measure => {
      console.log(measure);
      console.log(this.form.value[measure.value]);
      if(this.form.value[measure.value] === 'severe')
          this.showDiagnosis = true;
  });
}

selectedMeasures is a key value pair array logging measure always prints when the radio button is clicked But logging this.form.value[measure.value] only prints when the radio button is clicked twice.

For example, the radio button has a, b, c as values When a is clicked first, nothing prints. Then when b is clicked, a then prints. So it always prints the previous value of the radio button.

Please how can I fix this?

0 Answers
Related