Answer the question
In order to leave comments, you need to log in
How to pass form title in .html to .ts?
I want to pass on click to a function
addFields(addField: string, <тут название или массив формы из HTML>) {
(<FormArray><тут название или массив формы из HTML>.controls[addField]).push(new FormGroup({
date_from: new FormControl(''),
date_to: new FormControl('')
}));
Answer the question
In order to leave comments, you need to log in
addFields(addField: string, form: FormArray|FormGroup) {
form.controls[addField]).push(new FormGroup({
date_from: new FormControl(''),
date_to: new FormControl('')
}));
<button (click)="addFields('myField', myForm1)"></button>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question