Skip to main content
cngx-src documentation

CngxValueTransformer

Interface

projects/forms/field/value-transformer.token.ts

Import#

import { CngxValueTransformer } from '@cngx/forms/field'

Description#

Bidirectional contract between a directive's typed value and the DOM-visible display string. format(raw) produces the string written to the input on value-from-outside paths (writes from <cngx-form-field [field]>, RF setValue, programmatic value.set). parse(display) produces the typed value on user-input / blur paths.

Orthogonal to CNGX_FORM_FIELD_CONTROL: that token declares "I am the focusable element"; this token declares "I translate this element's value channel". The same directive may provide both - they are independent contracts.

Index#

Methods#

format#string
format(raw: T)

Produce the display string from the typed value.

@paramrawT
parse#T
parse(display: string)

Produce the typed value from the display string.

@paramdisplaystring