I want to change color of pagination When in the current page and when you in the first page or last page pagination will disable
disable like this:
app.html
<ul *ngIf="(ticket$| async)?.length != 0" class="pagination justify-content-end">
<li class="page-item">
<a class="page-link" (click)="previousIndex()">Previous<span aria-hidden="true">«</span></a>
</li>
<li *ngFor="let i of getArrayFromNumber((ticket$| async)?.length); let in = index" class="page-item">
<a class="page-link" (click)="updateIndex(in)">{{in+1}}<span class="sr-only">(current)</span></a>
</li>
<li class="page-item">
<a class="page-link" (click)="nextIndex()">Next</a>
</li>
</ul>
app.ts
getArrayFromNumber(length) {
this.max = (Math.ceil(length / 7))
return new Array(Math.ceil(this.max));
}
updateIndex(pageIndex) {
this.startIndex = pageIndex * 7;
this.endIndex = this.startIndex + 7;
}
previousIndex() {
if (this.tabindex > 0) {
this.tabindex -= 1
}
this.startIndex = this.tabindex * 7;
this.endIndex = this.startIndex + 7;
}
nextIndex() {
if (this.tabindex < this.max - 1) {
this.tabindex += 1
}
this.startIndex = this.tabindex * 7;
this.endIndex = this.startIndex + 7;
}
question from:https://stackoverflow.com/questions/66059343/color-of-pagination-bootstrap-current-page-angular