argos/dmp-frontend/src/app/models/external-dataset/ExternalDatasetModel.ts

30 lines
845 B
TypeScript

import { BaseErrorModel } from '../error/BaseErrorModel';
import { Serializable } from "../Serializable";
import { FormGenerator } from "../interfaces/FormGenerator";
import { FormGroup, FormBuilder } from "@angular/forms";
export class ExternalDatasetModel implements Serializable<ExternalDatasetModel>, FormGenerator<FormGroup>{
public abbreviation: String;
public id: String;
public label: String;
public reference: String;
public errorModel: BaseErrorModel;
fromJSONObject(item: any): ExternalDatasetModel {
this.abbreviation = item.abbreviation;
this.id = item.id;
this.label = item.label;
this.reference = item.reference;
return this;
}
buildForm(): FormGroup {
return new FormBuilder().group({
id: [this.id],
abbreviation: [this.abbreviation],
label: [this.label],
reference: [this.reference]
})
}
}