form-generation easy way to create dynamic form with Angular .
<app-form-generation [inputs]="Inputs" [config]="Config" > </app-form-generation>
export class Customer {
FirstName?: string;
LastName?: string;
}
Inputs?:Array<InputModel<Customer>>;
Config?:ConfigModel<Customer>;
this.Inputs = new Array<InputModel<Customer>>();
this.Inputs=[
{Name:x=>x.FirstName,Title:"First Name",Description:"Please set first name",InputType: InputType.Text,Validations: [Validators.required,Validators.minLength(10)] } as InputModel<Customer>,
{Name:x=>x.LastName,Title:"Last Name",Description:"Please set last name",InputType: InputType.Text } as InputModel<Customer>,
{Name:x=>x.FirstName,Title:"Insert",Description:"Please set first name",InputType:InputType.Button,onClick:(item)=>{
console.log("insert",item);
}
} as InputModel<Customer>,
];
name | decription |
---|---|
Text | create text input |
Number | create Number input |
PhoneNumber | create phone number input |
create Email input | |
Date | create Date picker input |
CheckBox | create CheckBox input |
Radio | create Radio input |
List | create List select element |
DatePeriod | create Date picker input |
Button | create Button |