MaterialRadioGroupComponent constructor
MaterialRadioGroupComponent(
- NgZone _ngZone,
- @Self() @Optional() NgControl? cd
Implementation
MaterialRadioGroupComponent(this._ngZone, @Self() @Optional() NgControl? cd) {
// When NgControl is present on the host element, the component participates
// in the Forms API.
cd?.valueAccessor = this;
_disposer.addStreamSubscription(
componentSelection.selectionChanges.listen((checkedChanges) {
// Need to uncheck if selection change was made via user action.
for (var checkedChange in checkedChanges) {
for (var radioComponent in checkedChange.removed) {
radioComponent.checked = false;
}
}
// In case this was programmatically selected, thus won't get updated
// by focus calls.
_resetTabIndex();
_selected = _selectedRadioComponent?.value;
if (_valueSelection != null && _selected != null) {
_valueSelection?.select(_selected);
}
_onChange.add(_selected);
}));
_disposer.addStreamSubscription(focusSelection.selectionChanges.listen((_) {
_resetTabIndex();
}));
}