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

25 lines
760 B
TypeScript
Raw Normal View History

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