mapToOptionalBlock
mapToOptionalBlock<
T>(data,enabled?):OptionalBlock<T>
Defined in: projects/ngx-signal-schema/src/lib/structure/optional-block.ts:120
Creates an OptionalBlock from the given data and enabled state. Useful for mapping domain models or DTOs to form values.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”T
The data to wrap.
enabled?
Section titled “enabled?”boolean = true
Whether the block should be enabled by default. Defaults to true.
Returns
Section titled “Returns”An OptionalBlock containing the data and enabled state.
Example
Section titled “Example”const block = mapToOptionalBlock({ name: 'John' });// { meta: { enabled: true }, data: { name: 'John' } }