import { FormGenerator } from '../interfaces/FormGenerator'; import { Serializable } from '../interfaces/Serializable'; import { FormGroup, FormBuilder } from '@angular/forms'; export class User implements Serializable, FormGenerator { public id: string; public email: string; public name: string; fromJSONObject(item: any): User { this.id = item.id; this.email = item.email; this.name = item.name; return this; } buildForm(): FormGroup { return new FormBuilder().group({ id: [this.id], email: [this.email], name: [this.name] }); } }