22 lines
584 B
TypeScript
22 lines
584 B
TypeScript
import { BaseModel } from './BaseModel';
|
|
import { FormGroup } from '@angular/forms';
|
|
import { FormGenerator } from './interfaces/FormGenerator';
|
|
import { Serializable } from './interfaces/Serializable';
|
|
export class Validation extends BaseModel implements Serializable<Validation>, FormGenerator<FormGroup> {
|
|
public type: string;
|
|
public value: string;
|
|
|
|
fromJSONObject(item: any): Validation {
|
|
this.type = item.type;
|
|
this.value = item.value;
|
|
return this;
|
|
}
|
|
|
|
buildForm(): FormGroup {
|
|
return this.formBuilder.group({
|
|
type: [this.type],
|
|
value: [this.value],
|
|
});
|
|
}
|
|
}
|