[FIXED] How to get a value from loop in angular

Issue

Three items present in orderDetail when I run the code every product show three radio buttons. How to get each product radio button value after click or change any radio button?

<div class="order-items-detail" *ngFor="let data of orderDetails.response.orderItems">
    <div class="p-field-radiobutton">
        <p-radioButton [(ngModel)]="data.item.picked" 
            [ngModelOptions]="{standalone: true}"
            value="Picked"
            class="radio-menter code hereargin"
            name="radioStatus" 
        ></p-radioButton>
        <br />
        <p-radioButton [ngModelOptions]="{standalone: true}" 
            [(ngModel)]="data.item.unavaliable"
            value="Unavailable"
            class="radio-margin"
            name="radioStatus"
        ></p-radioButton>
        <p-radioButton [ngModelOptions]="{standalone: true}"
            value="Substitute"
            class="radio-margin"
            name="radioStatus" 
            [(ngModel)]="data.item.substitude"
        ></p-radioButton>
    </div>
</div>

Solution

You could try using [(ngModel)] along with a variable that you want to assign the value.

Answered By – vsnikhilvs

Answer Checked By – Mildred Charles (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published