-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone
Description
Consider the following radio group:
<md-radio-group [ngModel]="model.accountType" ngControl="accountType">
<md-radio-button value="I">Individual</md-radio-button>
<md-radio-button value="J">Joint</md-radio-button>
</md-radio-group>
And then the ngModel object changes like so:
Original state: {accountType: 'J'}
New state: {}
I would expect the corresponding radio button ('Joint') to be unchecked. However, the 'Joint' radio button remains checked, which does not represent the true state of the control.
As a workaround, I'm able to bind to the md-radio-checked
class on each button, which removes the checked state of a radio button when the corresponding binding changes to undefined.
<md-radio-group [ngModel]="model.accountType" ngControl="accountType">
<md-radio-button value="I" [class.md-radio-checked]="model.accountType === 'I'">Individual</md-radio-button>
<md-radio-button value="J" [class.md-radio-checked]="model.accountType === 'J'">Joint</md-radio-button>
</md-radio-group>
This is especially important for a redux/ngrx application, in which you would expect radio buttons to become checked/unchecked as you replay recorded actions.
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent