为表格行创建动态ID

时间:2019-09-18 08:27:54

标签: html angular8

我在表格行中有一个复选框。当我选择任何一个复选框时,所有其他复选框都会被选中。我如何只能选择一个?选择此复选框后,我打算更新DB

我是新手,尝试为每行添加动态ID,但是不能这样做。Table可以完美地创建。 我希望单击它时选择一个checkbox,而不是选中所有行的复选框。     这是我的HTML

    <table class="table table-bordered">
      <thead>
        <tr>
          <th scope="col">Sl.</th>
          <th scope="col">Buyer</th>
          <th scope="col">Style No.</th>
          <th scope="col">Description</th>
          <th scope="col">FOB Price</th>
          <th scope="col">Remarks</th>
          <th scope="col">Approval</th>

        </tr>
      </thead>
      <tbody *ngFor="let entry of fabricReport,index as i " >
        <tr  >
          <td>{{i+1}}</td>
          <td>{{entry.buyerName}}</td>
          <td><a class="btn text-danger" (click)="getDataForReview(entry)" data-toggle="modal"
              data-target="#exampleModal">{{entry.styleCode}}</a></td>
          <td>{{entry.itemName}}</td>
          <td>{{entry.perUnitPrice}}</td>
          <td>{{entry.remarks}}</td>
          <td> <input  type="checkbox" 
              style="margin-top:0rem; margin-bottom:1rem; margin-left:1rem;" [checked]="entry.approval"
              [(ngModel)]="Fc.currentEntry.fabricPriceInformation[0].approval" 
              (click)="getservice(entry)"> </td>



        </tr>
      </tbody>
    </table>

0 个答案:

没有答案