argos/dmp-frontend/src/app/shared/componentsAdmin/combobox/combobox-component.ts

25 lines
760 B
TypeScript

import { FormGroup } from '@angular/forms';
import { Component, Input, OnInit } from '@angular/core';
import { Field } from '../../../models/datasetProfileAdmin/Field';
@Component({
selector: 'combobox-component',
templateUrl: './combobox-component.html'
})
export class ComboboxComponent implements OnInit {
@Input() dataModel: Field;
@Input() form: FormGroup;
type: string;
options = [{ id: "autocomplete", value: "autocomplete" }, { id: "wordlist", value: "wordlist" }];
ngOnInit() {
if (this.dataModel.data && this.form.get("data")) {
this.type = this.form.get("data").get("type").value;
}
}
onchangeCombo() {
if (this.form.get("data")) this.form.removeControl("data");
}
}