import { DataField } from './DataField'; import { FormGroup } from '@angular/forms' import { ListingItem } from '../common/ListingItem'; import { JsonSerializer } from '../../utilities/JsonSerializer'; export class AutocompleteData extends DataField{ public type: string; public url: string; public optionsRoot: string; public autoCompleteOptions: ListingItem = new ListingItem(); buildForm(): FormGroup { let formGroup = this.formBuilder.group({ label: [this.label], type: [this.type], url: [this.url], optionsRoot: [this.optionsRoot] }) formGroup.addControl("autoCompleteOptions", this.autoCompleteOptions.buildForm()); return formGroup; } fromJSONObject(item: any): AutocompleteData { this.type = item.type; this.url = item.url; this.label = item.label; this.optionsRoot = item.optionsRoot; this.autoCompleteOptions = JsonSerializer.fromJSONObject(item.autoCompleteOptions, ListingItem); return this; } }