import { BaseModel } from './BaseModel'; import { FormGroup } from '@angular/forms'; import { FormGenerator } from './interfaces/FormGenerator'; import { JsonSerializer } from '../utilities/JsonSerializer'; import { Serializable } from './interfaces/Serializable'; export class Field extends BaseModel implements Serializable,FormGenerator{ public id:string; public title:string; public value:string; public description:string; public extendedDescription:string; public viewStyle:string; public defaultVisibility:boolean; public page:number; fromJSONObject(item:any):Field{ this.id = item.id; this.title = item.title; this.value = item.value; this.description = item.description; this.extendedDescription = item.extendedDescription; this.viewStyle = item.viewStyle; this.defaultVisibility = item.defaultVisibility; this.page = item.page; return this; } buildForm():FormGroup{ let formGroup = this.formBuilder.group({ id: [this.id], title: [this.title], value: [this.value], description: [this.description], extendedDescription:[this.extendedDescription], viewStyle: [this.viewStyle], defaultVisibility:[this.defaultVisibility], page:[this.page] }); return formGroup; } }