26 lines
987 B
TypeScript
26 lines
987 B
TypeScript
import { Component, Input, OnInit } from '@angular/core';
|
|
import { UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
|
import { DescriptionTemplateSelectOptionEditorModel } from '../../../description-template-editor.model';
|
|
|
|
@Component({
|
|
selector: 'app-description-template-editor-select-field-component',
|
|
styleUrls: ['./description-template-editor-select-field.component.scss'],
|
|
templateUrl: './description-template-editor-select-field.component.html'
|
|
})
|
|
export class DescriptionTemplateEditorSelectFieldComponent implements OnInit {
|
|
|
|
@Input() form: UntypedFormGroup;
|
|
|
|
ngOnInit() {
|
|
}
|
|
|
|
addNewRow() {
|
|
const selectOptions: DescriptionTemplateSelectOptionEditorModel = new DescriptionTemplateSelectOptionEditorModel();
|
|
(<UntypedFormArray>this.form.get('data').get('options')).push(selectOptions.buildForm());
|
|
}
|
|
|
|
deleteRow(intex: number) {
|
|
if (this.form.get('data').get('options')) { (<UntypedFormArray>this.form.get('data').get('options')).removeAt(intex); }
|
|
}
|
|
}
|