28 lines
675 B
TypeScript
28 lines
675 B
TypeScript
import { Serializable } from "../Serializable";
|
|
import { ValidationContext } from "../../utilities/validators/ValidationContext";
|
|
import { FormGroup, FormBuilder } from "@angular/forms";
|
|
|
|
export class TagModel implements Serializable<TagModel> {
|
|
|
|
public id: string;
|
|
public name: string;
|
|
|
|
constructor(id?: string, name?: string) {
|
|
this.id = id;
|
|
this.name = name;
|
|
}
|
|
|
|
fromJSONObject(item: any): TagModel {
|
|
this.id = item.id;
|
|
this.name = item.name;
|
|
return this;
|
|
}
|
|
|
|
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
|
return new FormBuilder().group({
|
|
id: [this.id],
|
|
name: [this.name]
|
|
})
|
|
}
|
|
}
|