docs: improve DefaultValueAccessor directive docs (#39404)
This commit improves the DefaultValueAccessor directive docs by: - adding the `ngDefaultControl` as a search keyword to the description - adding an example of the `ngDefaultControl` usage Closes #35375. PR Close #39404
This commit is contained in:
parent
cf60e0e889
commit
1db4f212e5
|
@ -36,6 +36,9 @@ export const COMPOSITION_BUFFER_MODE = new InjectionToken<boolean>('CompositionE
|
|||
|
||||
/**
|
||||
* @description
|
||||
*
|
||||
* {@searchKeywords ngDefaultControl}
|
||||
*
|
||||
* The default `ControlValueAccessor` for writing a value and listening to changes on input
|
||||
* elements. The accessor is used by the `FormControlDirective`, `FormControlName`, and
|
||||
* `NgModel` directives.
|
||||
|
@ -55,6 +58,15 @@ export const COMPOSITION_BUFFER_MODE = new InjectionToken<boolean>('CompositionE
|
|||
* <input type="text" [formControl]="firstNameControl">
|
||||
* ```
|
||||
*
|
||||
* This value accessor is used by default for `<input type="text">` and `<textarea>` elements, but
|
||||
* you could also use it for custom components that have similar behavior and do not require special
|
||||
* processing. In order to attach the default value accessor to a custom element, add the
|
||||
* `ngDefaultControl` attribute as shown below.
|
||||
*
|
||||
* ```
|
||||
* <custom-input-component ngDefaultControl [(ngModel)]="value"></custom-input-component>
|
||||
* ```
|
||||
*
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @ngModule FormsModule
|
||||
* @publicApi
|
||||
|
|
Loading…
Reference in New Issue