Answer the question
In order to leave comments, you need to log in
How to pass the value of only one text field from the group to the component?
In the component template, I loop out a group of text fields:
<input type="text" name="arr_text[]" [(ngModel)]="text_val">
<input type="text" name="arr_text[]" [(ngModel)]="text_val">
<input type="text" name="arr_text[]" [(ngModel)]="text_val">
<input type="text" name="arr_text[]" [(ngModel)]="text_val">
text_val: string;
Answer the question
In order to leave comments, you need to log in
It is not clear why you need to change one value from several inputs, but keep
text_val = new FormControl();
<input type="text" name="arr_text[]" [formControl]="text_val">
<input type="text" name="arr_text[]" [formControl]="text_val">
<input type="text" name="arr_text[]" [formControl]="text_val">
<input type="text" name="arr_text[]" [formControl]="text_val">
this.text_val.value
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question