Function

createWrappers

@ng-forge/dynamic-forms

Bundle wrapper registrations into a single object that can be passed to provideDynamicForm(...).

Signature

function createWrappers<
  const T extends readonly WrapperRegistration[]
>(registrations?: T): WrappersBundle<T>

Type Parameters

NameConstraintDefaultDescription
Treadonly WrapperRegistration[]--

Parameters

NameTypeDescription
registrations?T-

Returns

WrappersBundle<T>

Examples

const appWrappers = createWrappers(
  {
    wrapperName: 'section',
    loadComponent: () => import('./section-wrapper'),
    props: wrapperProps<SectionWrapper>(),
  },
  {
    wrapperName: 'highlight',
    loadComponent: () => import('./highlight-wrapper'),
    types: ['input', 'select'],
    props: wrapperProps<HighlightWrapper>(),
  },
);

declare module '@ng-forge/dynamic-forms' {
  interface FieldRegistryWrappers extends InferWrapperRegistry<typeof appWrappers> {}
}

bootstrapApplication(AppComponent, {
  providers: [provideDynamicForm(appWrappers)],
});