How to check last record in table in Angular
P粉668146636
P粉668146636 2023-08-14 14:05:14
0
1
343
<p>I have this table row</p> <pre class="brush:php;toolbar:false;"><tbody> <tr *ngFor="let data of List | paginate : { itemsPerPage: 10, currentPage: p }; let i = index"> <td>{{ data.Name }}</td> <td> </td> ... </tr> </tbody></pre> <p>I want to check the last record of each page. Suppose there are 12 records, and each page has <code>10</code>, then another page has <code>2</code> strips, I want to check the last record of each page and apply CSS style on the last record of each page. </p> <p>Is there any solution? Thank you</p>
P粉668146636
P粉668146636

reply all(1)
P粉578343994

You have two choices.

Option 1: Conditionally apply a class using ngClass

<tr *ngFor="let data of List | paginate : { itemsPerPage: 10, currentPage: p }; let last = last" [ngClass]="{ yourclass: last }">

Option 2: Select the last tr

in your stylesheet
tr:last-of-type {
  // 你的样式
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!