RadioControlValueAccessor class

The accessor for writing a radio control value and listening to changes that is used by the NgModel, NgFormControl, and NgControlName directives.

Example

@Component(
  template: '''
    <input type="radio" name="food" [(ngModel)]="foodChicken">
    <input type="radio" name="food" [(ngModel)]="foodFish">
  '''
)
class FoodCmp {
  RadioButtonState foodChicken = new RadioButtonState(true, "chicken");
  RadioButtonState foodFish = new RadioButtonState(false, "fish");
}
Implemented types
Annotations
  • @Directive(selector: 'input[type=radio][ngControl],' 'input[type=radio][ngFormControl],' 'input[type=radio][ngModel]', providers: [radioValueAccessor])

Constructors

RadioControlValueAccessor(HtmlElement _element, RadioControlRegistry _registry, Injector _injector)

Properties

hashCode int
The hash code for this object.
no setterinherited
name String?
getter/setter pair
onChange ChangeFunction<RadioButtonState>
getter/setter pairinherited
onTouched TouchFunction
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

changeHandler() → void
fireUncheck() → void
ngOnDestroy() → void
Executed before the directive is removed from the DOM and destroyed.
ngOnInit() → void
Executed after the first change detection run for a directive.
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".
override
registerOnChange(ChangeFunction<RadioButtonState> fn) → void
Set the function to be called when the control receives a change event.
inherited
registerOnTouched(TouchFunction fn) → void
Set the function to be called when the control receives a touch event.
inherited
toString() String
A string representation of this object.
inherited
touchHandler() → void
inherited
writeValue(RadioButtonState? value) → void
Write a new value to the element.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited