RadioControlValueAccessorlink
Writes radio control values and listens to radio control changes.
选择器
输入参数
name
绑定到 RadioControlValueAccessor.name
value
绑定到 RadioControlValueAccessor.value
说明
Used by NgModel
, FormControlDirective
, and FormControlName
to keep the view synced with the FormControl
model.
If you have imported the FormsModule
or the ReactiveFormsModule
, this value accessor will be active on any radio control that has a form directive. You do not need to add a special selector to activate it.
How to use radio buttons with form directives
To use radio buttons in a template-driven form, you'll want to ensure that radio buttons in the same group have the same name
attribute. Radio buttons with different name
attributes do not affect each other.
When using radio buttons in a reactive form, radio buttons in the same group should have the same formControlName
. You can also add a name
attribute, but it's optional.
- npm package:
@angular/forms
属性
属性名 | 类型 | 说明 |
---|---|---|
onChange | ||
onTouched | ||
name | ||
formControlName | ||
value |
方法
参数没有参数。 返回值
|
参数没有参数。 返回值
|
参数
返回值
|
参数
返回值
|
参数
返回值
|
参数
返回值
|
参数
返回值
|