I want to show the detail of specific order when I click on button but it get rendered on every order as this is in for loop

bipin
<tbody>
  <ng-container *ngFor="let orderdetail of listoforderdetail.listoforders">
    <tr>
      <td>{{orderdetail.orderId}}</td>
      <td>{{orderdetail.ammount | currency:"Rs. "}}</td>
      <td>{{datepipe.transform(orderdetail.orderDate,'yyyy-MM-dd HH:mm:ss')}}</td>
      <td><button class="btn primary sm" (click)="details=true">Details</button></td>
    </tr>
    <div *ngIf="details">detail will come here when we click on button on specific ordder</div>
  </ng-container>
</tbody>

when I click on detail button of any row of order table ,the detail get rendered but it get rendered below each row as my button and div is in for loop . When I click the button, I want the specific order detail to appear.

enter image description here

Kepotx

It appears below each row, because details is a global variable, which is shared with all the rows. Therefore, once you click on the button, details become true, and the ngif condition becomes true for each row.

You need to have a condition depending on the row itself, so only the selected row become visible

<tbody>
    <ng-container *ngFor="let orderdetail of listoforderdetail.listoforders">
        <tr>
            <td>{{orderdetail.orderId}}</td>
            <td>{{orderdetail.ammount | currency:"Rs. "}}</td>
            <td>{{datepipe.transform(orderdetail.orderDate,'yyyy-MM-dd HH:mm:ss')}}</td>
            <td><button class="btn primary sm" (click)="orderdetail.visible=true">Details</button></td>
        </tr>
        <div *ngIf="orderdetail.visible">detail will come here when we click on button on specific ordder</div>
    </ng-container>
</tbody>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Focus on iframe every time I click on specific button

I want to show product items into shopping cart when i click add to card button using laravel 6.0?

When i click on any other button like desi food my order button is triggered

I want to add cancel order button in woocommerce template order details for guest users only?

I want to download whole webpage when i click button

How can I reverse the order of a <ul> with the click of a button?

ORDER BY p.display_order and i.img show thumbnail with specific image order

I want to get space for status automatically when I will click on update button

I have button when I click on that button I want to show progress dialog only for 2 seconds, how to dismiss progress dialog after 2 seconds

i want to refresh the checkboxes when i click on the eventlistner button

Sort the table ascending & descending order when i click on button in reactjs

I want to show status with order when i search order by created_at date using laravel

Trying to add a button to this script so it will generate the numbers on click. Also I dont want the numbers to ever repeat in the same order

How do I get PineScript to a specific order?

I want to click this button on the Pubchem

i want to show a div when clicking a specific button (a help button) with html /css / javascript

How to calculate balance when the records I want to show in desc order?

How can I show some components when i click on a button?

On Click i want to show button and again on click i want to hide a button

How do I make a button click change the django order_by?

when i click a button second time my label want to dissappear

What I want to do with this exercise is to show the gif and the text only when I click on the button

I want to click on a radio button

How do I make a <button> show a specific text in console.log when I click on the button?

I have a scrollbar Buttons here and I want to ask how can I get a specific output when I press a specific button

When I click the button, I want to update the database

I'm trying to make a button in c# windows form app that when i click on it it show a picture i want

Want to display more information when i click on see more button

I want to change a url when I click a button