Binds a form FieldTree to a UI control that edits it. A UI control can be one of several things:
- A native HTML input or textarea
- A signal forms custom control that implements
FormValueControlorFormCheckboxControl - A component that provides a
ControlValueAccessor. This should only be used for backwards compatibility with reactive forms. Prefer options (1) and (2).
API
class FormField<T> { readonly element: HTMLElement; readonly injector: Injector; readonly @Input() formField: InputSignal<FieldTree<T>>; readonly state: Signal<[T] extends [AbstractControl] ? CompatFieldState<T, string | number> : FieldState<T, string | number>>; protected getOrCreateNgControl(): InteropNgControl;}
element
HTMLElementinjector
InjectorformField
InputSignal<FieldTree<T>>state
Signal<[T] extends [AbstractControl] ? CompatFieldState<T, string | number> : FieldState<T, string | number>>getOrCreateNgControl
InteropNgControlLazily instantiates a fake NgControl for this form field.
@returns
InteropNgControlDescription
Binds a form FieldTree to a UI control that edits it. A UI control can be one of several things:
- A native HTML input or textarea
- A signal forms custom control that implements
FormValueControlorFormCheckboxControl - A component that provides a
ControlValueAccessor. This should only be used for backwards compatibility with reactive forms. Prefer options (1) and (2).
This directive has several responsibilities:
- Two-way binds the field state's value with the UI control's value
- Binds additional forms related state on the field state to the UI control (disabled, required, etc.)
- Relays relevant events on the control to the field state (e.g. marks touched on blur)
- Provides a fake