Skip to content

Instantly share code, notes, and snippets.

@azaharafernandezguizan
Created December 21, 2018 11:18
Show Gist options
  • Save azaharafernandezguizan/07ed249c22a5a8a2681653b0ab8e74d8 to your computer and use it in GitHub Desktop.
Save azaharafernandezguizan/07ed249c22a5a8a2681653b0ab8e74d8 to your computer and use it in GitHub Desktop.
Angular table with pagination and sorting.
<div>
<ul>
<li (click) = "sortTable('name')">
nombre
<i [class]="getIcon('name')" aria-hidden="true"></i>
</li>
<li (click) = "sortTable('lastname')">
apellidos
<i [class]="getIcon('lastname')" aria-hidden="true"></i>
</li>
<li (click) = "sortTable('email')">
teléfono
<i [class]="getIcon('email')" aria-hidden="true"></i>
</li>
<li (click) = "sortTable('course')">
email
<i [class]="getIcon('course')" aria-hidden="true"></i>
</li>
</ul>
<ul *ngFor="let student of studentsList | sortPipe:path:order">
<li>{{student.name}}</li>
<li>{{student.lastname}}</li>
<li>{{student.email}}</li>
<li>{{student.course}}</li>
</ul>
<div>
<ngb-pagination *ngIf="showPagination" [collectionSize]="totalItems" [(page)]="page"
(pageChange)="loadPage($event)"></ngb-pagination>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment