I am encountering an issue with the UI update on my Radiobox group.
<div *ngFor="let options of dateOptions">
<input class="form-check-input" [value]='options.value' (ngModelChange)="selectionChanged($event)" type="radio" name="dateOptions"
[(ngModel)]="selectedOption">
<label class="mr-3">
{{options.displayText}}
</label>
</div>
The binding is functioning well. My component extends ControlValueAccessor and when the selectedOption
is updated as follows:
writeValue(dateId: DateIds): void {
const matchingOption = this.dateOptions.find((option) => equal(option.id, dateId))
this.selectedOption= matchingOption ? matchingOption.value : this.selectedOption
this.selectionChanged(this.selectedOption)
}
The value of selectedOption
is set correctly, but the UI only updates when I interact with the component. It doesn't have to be changing the selection; even opening my datepicker is enough for the UI to refresh.
According to the documentation, the UI should change when selectedOption
changes to match the value.