Skip to main content
cngx-src documentation

CngxSliderFieldBridge

DirectivePrimaryv0.1.0WCAG AA

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.

https://cngxjs.github.io/cngx/examples/#/forms/field/slider-forms/signal-forms-slider

Metadata#

Host#

Providers#

CNGX_FORM_FIELD_CONTROL
useExisting CngxSliderFieldBridge

Relationships

Index#

Instance Properties#

focused#unknown
Readonly
this.focusedState.asReadonly()

HostBindings#

BindingExpression
[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#

EventHandler
(focusin)focusin()
(focusout)focusout()