Function
provideDynamicForm
@ng-forge/dynamic-forms
Provider function to configure the dynamic form system with field types and options.
This function creates environment providers that can be used at application or route level to register field types. It provides type-safe field registration with automatic type inference.
Signature
function provideDynamicForm<
const T extends FieldTypeOrFeature[]
>(items?: T): ProvideDynamicFormResult<ExtractFieldTypes<T> extends FieldTypeDefinition<any>[] ? ExtractFieldTypes<T> : FieldTypeDefinition<any>[]>Type Parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
T | FieldTypeOrFeature[] | - | Array of field type definitions for type inference |
Parameters
| Name | Type | Description |
|---|---|---|
items? | T | - Field type definitions and/or features (like withLoggerConfig) |
Returns
ProvideDynamicFormResult<ExtractFieldTypes<T> extends FieldTypeDefinition<any>[] ? ExtractFieldTypes<T> : FieldTypeDefinition<any>[]>
Examples
// Application-level setup
bootstrapApplication(AppComponent, {
providers: [
provideDynamicForm(...withMaterialFields())
]
});// Disable logging
bootstrapApplication(AppComponent, {
providers: [
provideDynamicForm(
...withMaterialFields(),
withLoggerConfig(false)
)
]
});// Custom field types with type inference
import { CustomFieldType, AnotherFieldType } from './custom-fields';
export const appConfig: ApplicationConfig = {
providers: [
provideDynamicForm(CustomFieldType, AnotherFieldType)
]
};packages/dynamic-forms/src/lib/providers/dynamic-form-providers.ts:105