import { BaseModel } from '../BaseModel'; import { FormGroup } from '@angular/forms'; import { FormGenerator } from '../interfaces/FormGenerator'; import { Serializable } from '../interfaces/Serializable'; export class Rule extends BaseModel implements Serializable,FormGenerator{ public sourceField:string; public target:string; public value: string; public ruleType: string; public ruleStyle: string; public valueType: string; fromJSONObject(item:any):Rule{ this.sourceField = item.sourceField; this.target = item.target; this.value = item.value; this.ruleType = item.ruleType; this.ruleStyle = item.ruleStyle; this.valueType = item.valueType; return this; } buildForm():FormGroup{ let formGroup = this.formBuilder.group({ sourceField: [this.sourceField], target: [this.target], ruleStyle: [this.ruleStyle], value: [this.value], ruleType: [this.ruleType], valueType: [this.valueType] }); return formGroup; } }