Multiple input ...How should I get value?

<p *ngFor="let item2 of result let i = index" >
     <input [(ngModel)]=relayingId><button (click)="result">click</button>

have code like above and I have many input element according to array of result.
user should input only one of inputs then click button

but problem is that when I type something on input value , it applied to the others input like pic below

1 Like

because you are binding everything to a single object… you shouldn’t use *ngFor with inputs

1 Like

oh…but I should use for loop and each of loop should have input…
is there any other way to do so?

but why do you want to use loop with inputs? this is some hell bad design in most of the cases

1 Like

I solved it by giving a input class name class="{{i}}"

on .ts

var input=(document.getElementsByClassName(i)[0]).value;