FIELD_SIGNAL_CONTEXT
Injection token for providing field signal context to mappers and components.
The field signal context is the "nervous system" of the dynamic form library, providing access to:
- The form instance and structure
- Current form values (as signals)
- Default values
- Validation messages
- The injector for creating components
This token is provided by the DynamicForm component and can be scoped for nested forms (Groups, Arrays) via child injectors.
Presentation
const FIELD_SIGNAL_CONTEXT : InjectionToken<
FieldSignalContext <Record<string, unknown>>
>;Example usage
// In a mapper function
export function mapValueField(fieldDef: BaseValueField <any, any>): Binding[] {
const context = inject(FIELD_SIGNAL_CONTEXT );
const form = context.form();
// ... use context
}
// In a component
export class MyFieldComponent {
private context = inject(FIELD_SIGNAL_CONTEXT );
}