Skip to main content

QueryParamBinding

Options for one form node or writable signal in a query parameter map.

Import

import type { QueryParamBinding } from '@ngblocks/form-nodes/router';

When to use it

Reuse the configuration for one field and its query parameter.

Declaration

type QueryParamBinding<T> = {
source: Signal<T> & ({
$api: Pick<NodeApi, 'nodeType' | 'set'>;
} | (Pick<WritableSignal<NoInfer<T>>, 'set'> & {
$api?: never;
}));
serializer?: QueryParamSerializer<NoInfer<T>> | 'json' | ([
NonNullable<NoInfer<T>>
] extends [
string
] ? string extends NoInfer<T> ? 'string' : never : never) | ([
NonNullable<NoInfer<T>>
] extends [
number
] ? number extends NoInfer<T> ? 'number' | 'integer' : never : never) | ([
NonNullable<NoInfer<T>>
] extends [
boolean
] ? boolean extends NoInfer<T> ? 'boolean' : never : never) | ([
NonNullable<NoInfer<T>>
] extends [
readonly string[]
] ? string[] extends NoInfer<T> ? 'array' : never : never);
defaultValue?: NoInfer<T>;
clearOnDefault?: boolean;
history?: 'replace' | 'push';
injector?: Injector;
};

Type parameters

ParameterConstraintDefault
TUnconstrainedRequired

Declared members

The declaration above also includes inherited contracts and overloads where applicable.

MemberMeaning
sourceExisting field, form, group, array, or writable Angular signal to synchronize. Nodes keep committed-value observation, validation, and node ownership. Signals respect their own equality and use the entry injector. Readonly signals are rejected. Objects and arrays need an explicit serializer. Aggregate imports use the node set operation.
serializerA built-in serializer name or a custom conversion contract compatible with the source.
defaultValueValue used for missing or malformed parameters. Default: source value captured at registration. Nodes capture their committed value; signals use their current value.
clearOnDefaultRemove values whose serialized representation matches the default. Default: false.
historyHistory behavior for this key. Default: inherit the helper option, otherwise replace.
injectorAdditional lifetime owner for this entry.