@gisgo/dynamic-form
v1.0.1
Published
This Angular library make form creation easy.
Downloads
5
Maintainers
Readme
Gisgo Dynamic Form
Gisgo Dynamic Form is a dynamic (JSON powered) form library for Angular that bring unmatched maintainability to your application's forms.
Install
Run npm install @gisgo/dynamic-form
Import Module
After installing the library, go to the AppModule
or sub-module and run import DynamicFormModule.forChild()
import {DynamicFormModule} from '@gisgo/dynamic-form';
@NgModule({
declarations: [],
imports: [
DynamicFormModule.forChild()
]
})
export class AppModule { }
Use Dynamic Form
To generate your form you need to define your list of fields:
public fields FieldConfig[] = [
{
component: 'input-field',
attribute: 'login',
type: 'text',
label: 'Login',
placeholder: 'Enter your Login',
value: '',
validation: [Validators.required]
},
{
component: 'input-field',
attribute: 'password',
type: 'password',
label: 'Password',
placeholder: 'Enter your password',
validation: [Validators.email]
},
];
in your component html file use gisgo-dynamic-form
directive:
<gisgo-dynamic-form [fields]="fields" (submit)="submit($event)"></gisgo-dynamic-form>
Import Module with custom fields
import {DynamicFormModule} from '@gisgo/dynamic-form';
@NgModule({
declarations: [],
imports: [
DynamicFormModule.forChild({
'custom-field': CustomFieldComponent
})
]
})
export class AppModule { }