I have following html code, when I click on the button need to be change same row text field value. My question is how to refer the input field and append the value?
app.component.html
<div *ngFor="let item of [1,2,3,4]; let i = index">
<input type="text" #textField{{i}} />
<button #btn{{i}} (click)="myEvent(i)">Click to Change</button>
</div>
app.component.ts
export class AppComponent {
myEvent(i) {
if(i == 0) {
// textField0 append a new value to the text field
}
}
}
Thanks all