CngxSliderFieldBridge
projects/forms/field/slider-field-bridge.directive.ts
Import#
import { CngxSliderFieldBridge } from '@cngx/forms/field'
Description#
Bridges a <cngx-slider> (or a bare [cngxSliderTrack]) into a
<cngx-form-field>.
Same-element on the slider host. Provides CNGX_FORM_FIELD_CONTROL so the
form-field presenter discovers the slider, two-way-syncs the bound Field<T>
value with the slider's value model, and projects ARIA attributes from the
presenter onto the host.
The slider atom stays completely Forms-agnostic - this directive is the only
place that imports from @cngx/forms/field / @angular/forms.
Usage
<cngx-form-field [field]="form.volume">
<label cngxLabel>Volume</label>
<cngx-slider cngxSliderFieldBridge [min]="0" [max]="100" [step]="5" showValue />
<cngx-field-errors />
</cngx-form-field>For Reactive Forms, wrap the FormControl in adaptFormControl(...) and pass
the returned accessor to [field] - the bridge doesn't care about the source.
Metadata#
Host#
Providers#
CNGX_FORM_FIELD_CONTROL- useExisting
CngxSliderFieldBridge
Relationships
Depends on1
Index#
Properties
Derived State
HostBindings
Instance Properties#
HostBindings#
| Binding | Expression |
|---|---|
[id] | id() |
[attr.aria-describedby] | describedBy() |
[attr.aria-labelledby] | labelledBy() |
[attr.aria-invalid] | ariaInvalid() |
[attr.aria-required] | ariaRequired() |
[attr.aria-busy] | ariaBusy() |
[attr.aria-errormessage] | ariaErrorMessage() |
[attr.aria-readonly] | ariaReadonly() |
HostListeners#
| Event | Handler |
|---|---|
(focusin) | focusin() |
(focusout) | focusout() |