argos/dmp-frontend/src/app/models/common/ListingItem.ts

21 lines
548 B
TypeScript

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