When working with an angular form to manage employee details, I encountered a scenario where the valueChanges.subscribe()
method was instrumental in detecting changes in dropdown values when adding new employees.
this.createEmpForm.get('employee_id').valueChanges.subscribe(value => {
...
});
However, during editing mode, a backend error would occur if attempting to save data after changing the value of a specific user's dropdown/input box without physically clicking on the dropdown. This happened because, even though the data was pre-populated from the backend, the valueChanges.subscribe()
event did not trigger since the default dropdown state wasn't altered. How can this issue be resolved?