When you change the options on an hc-select, the selected option no longer matches the form control's (or ngModel's) value in Angular.
Reproduction
Steps to reproduce:
Create an hc-select and use a *ngFor to populate options. Set the hc-select's value using a formControl or ngModel, but set it with a primitive value (like a numeric id).
Select any option other than the first one.
Programmatically change the list used by the *ngFor. Make sure one of the new items in the list has the same id as the option you've selected.
The select resets to the first option in the list, even though the value of the hc-select matches the id of one of the other options.
Summary
When you change the options on an
hc-select
, the selected option no longer matches the form control's (or ngModel's) value in Angular.Reproduction
Steps to reproduce:
*ngFor
to populate options. Set the hc-select's value using aformControl
orngModel
, but set it with a primitive value (like a numericid
).*ngFor
. Make sure one of the new items in the list has the sameid
as the option you've selected.select
resets to the first option in the list, even though the value of thehc-select
matches theid
of one of the other options.Stackblitz reproduction: https://stackblitz.com/edit/angular-9fzydn?file=src%2Fapp%2Fselect-forms%2Fselect-forms-example.component.ts
Additional context
This might be a different manifestation of the same bug reported in #2207.