【发布时间】:2021-08-22 11:43:18
【问题描述】:
我是 Angular 的新手,如果有人能帮我为表格添加分页,我将不胜感激。 我创建了一个 CRUD 项目,其中后端在 Spring boot 中完成,前端在 Angular 中完成。 要进行布局,我想直接使用 bootstrap,而无需在 springboot 中为布局创建特定代码,然后直接在 Angular 中工作。 我在网上看到了一些,但在我的情况下找不到简单的东西。 这是我与感兴趣的表相关的 html 代码:
<div class="panel-heading">
<h1 style="text-align: center">Students</h1><br>
<div class="form-group">
<input type="text" class="form-control search-input" placeholder="Search..." [(ngModel)]="filterTerm">
</div>
<div class="panel-body">
<table class="table table-hover table-sm">
<thead class="thead-light">
<tr>
<th>Student code</th>
<th>Student name</th>
<th>Student date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let student of students| filter:filterTerm">
<td>{{student.codestudent}}</td>
<td>{{student.namestudent}}</td>
<td>{{student.datestudent}}</td>
<td><button (click)="deleteStudent(student.codestudent)" class='btn btn-primary'><i
class="fa fa-futboll-0">Delete</i></button>
</td>
</tr>
</tbody><br>
</table>
</div>
谁能帮帮我?我无限感谢你。
【问题讨论】:
-
一个选项,你必须编写一个逻辑,将你的总记录除以每页的帖子和其他一些东西。第二,您可以使用提供分页、排序、实时搜索的数据表。有一个look
标签: angular bootstrap-4 pagination