provideDynamicForm
| Generic types: | T |
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.
Presentation
function provideDynamicForm (
items: T,
): ProvideDynamicFormResult<
ExtractFieldTypes<T> extends FieldTypeDefinition <any>[]
? ExtractFieldTypes<T>
: FieldTypeDefinition <any>[]
>;Returns
ProvideDynamicFormResult<ExtractFieldTypes<T> extends FieldTypeDefinition <any>[] ? ExtractFieldTypes<T> : FieldTypeDefinition <any>[]> -Environment providers for dependency injection with type inference
Parameters
| Name | Type | Description |
|---|---|---|
| items | T | Field type definitions and/or features (like withLogger) |
Example usage
// Application-level setup
bootstrapApplication(AppComponent, {
providers: [
provideDynamicForm (...withMaterialFields ())
]
});// With logging configuration
bootstrapApplication(AppComponent, {
providers: [
provideDynamicForm (
...withMaterialFields (),
withLogger ({ level: LogLevel .Debug })
)
]
});// Route-level setup
const routes: Routes = [
{
path: 'form',
component: FormComponent,
providers: [provideDynamicForm (...withMaterialFields ())]
}
];// Custom field types with type inference
import { CustomFieldType, AnotherFieldType } from './custom-fields';
export const appConfig: ApplicationConfig = {
providers: [
provideDynamicForm (CustomFieldType, AnotherFieldType)
]
};