UNPKG

ng2-simple-forms

Version:

A simple(ish) module for creating accessible, reactive forms.

33 lines (32 loc) 1.2 kB
import { FormBuilder } from '@angular/forms'; import { FormElement, FormElementConfig, FormElementOptions } from '../simple-forms.types'; export declare class SimpleFormBuilder { static formBuilder: FormBuilder; constructor(); /** * Get Validators from FormElement definition properties */ static getValidators(element: FormElement): any; /** * Create a FormGroup from a list FormElement definitions */ static toFormGroup(formElements: FormElement[]): any; /** * Create a 'FormDetails' * Takes a group of FormElements, and returns an * Unwrapped form object of formGroup, and * { inputId: string, element: FormElement } array. */ static toFormDetails(formElements: FormElement[]): any; /** * Create a form from JSON */ static fromJson(jsonValue: any): any; /** * Simple wrapper to create a FormElement with basic * attributes */ static createElement(type: string, label: string, options?: FormElementOptions, config?: FormElementConfig): FormElement; static setOptions(element: FormElement, options: FormElementOptions): FormElement; static toInputId(str: string): string; }