Const
DEFAULT_PROPS
@ng-forge/dynamic-forms
Injection token for form-level default props.
Default props are form-wide property defaults that are merged with field-level props. Field props take precedence over default props.
Unlike FIELD_SIGNAL_CONTEXT which is re-provided by container components (Group, Array),
DEFAULT_PROPS is provided ONCE at the DynamicForm level and inherited by all children
via Angular's hierarchical injector.
The token provides a Signal to enable reactivity - when config changes, mappers
that read the signal inside their computed() will automatically update.
Signature
const DEFAULT_PROPS: InjectionToken<Signal<Record<string, unknown>>>Examples
// In a mapper function
const defaultPropsSignal = inject(DEFAULT_PROPS);
return computed(() => {
const defaultProps = defaultPropsSignal?.(); // Read inside computed for reactivity
const baseInputs = buildBaseInputs(fieldDef, defaultProps);
// ...
});packages/dynamic-forms/src/lib/models/field-signal-context.token.ts:108