MaterialRadioGroupComponent class
Group containing multiple material radio buttons, enforcing that only one value in the group is selected.
You can get the value via both selected and ngModel
, but you should
avoid using both, because ngModel is also getting the value by listening
to onChange, so the values may appear out of sync.
Preselect of value at group level is done via managed zone, so if it's possible to set it at radio level, do that instead.
Per accessibility guide line:
- SPACE selects
- Arrow keys moves focus to next / previous options and selects it
- CTL + arrow keys moves focus without selecting
- Focus will wrap around to first / last option when navigating with arrows
- When navigating with TAB, if nothing is selected, focus goes to first or last option that's not disabled, depending on direction, otherwise focus goes to the selected (except when disabled, then skips group entirely); and jumps out of the group on second tab.
- Annotations
-
- @Component(selector: 'material-radio-group', template: '<ng-content></ng-content>', styleUrls: ['material_radio_group.scss.css'], changeDetection: ChangeDetectionStrategy.onPush, visibility: Visibility.all)
Constructors
- MaterialRadioGroupComponent(NgZone _ngZone, @Self() @Optional() NgControl? cd)
Properties
-
componentSelection
→ SelectionModel<
MaterialRadioComponent> -
Internal selection model containing the radio component.
final
-
focusSelection
→ SelectionModel<
MaterialRadioComponent> -
Internal selection model to keep track of radio currently in focus.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- onChange → Stream
-
Published when selection changes. Prefer
(ngModelChange)
.no setter -
radioComponents
← List<
MaterialRadioComponent> -
no getter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selected ↔ dynamic
-
Value of currently selected radio. Prefer
[ngModel]
.getter/setter pair - valueSelection ← SelectionModel
-
Selection model containing value object.
no getter
Methods
-
ngAfterContentInit(
) → void -
ngOnDestroy(
) → void - Executed before the directive is removed from the DOM and destroyed.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDisabledChanged(
bool isDisabled) → void - This function is called when the control status changes to or from "DISABLED".
-
registerOnChange(
ChangeFunction callback) → void - Set the function to be called when the control receives a change event.
-
registerOnTouched(
TouchFunction _) → void - Set the function to be called when the control is touched.
-
toString(
) → String -
A string representation of this object.
inherited
-
writeValue(
dynamic selectedValue) → void - Write a new value to the element.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited