Reputation: 65
I am using ngx-bootstrap pagination and I am trying to set value to page through ts file. I am setting this value from two component and in one component value is setting and pagination is set to the page, but in other component it is not setting the value to current page
HTML:
<pagination
[boundaryLinks]="true"
(pageChanged)="pageChanged($event)"
[totalItems]="totalItems"
[(ngModel)]="currentPage"
previousText="‹" nextText="›" firstText="«" lastText="»"
[maxSize]="3">
</pagination>
I am setting value in ngOnInit():
this.currentPage = this.pageNavigaiton.first;
I have tried giving directly value to the currentPage:
this.currentPage = 3;
but this is also not working
version:
"ngx-bootstrap": "^2.0.0-rc.0",
Upvotes: 2
Views: 2294
Reputation: 5858
In your page init you can use: setTimeout(() => this.currentPage = whateverNumberYouLike);
Upvotes: 3