간단한 페이지 매김 구성 요소에 ng2-bootstrap을 설치했습니다. 설명서 (https://valor-software.com/ng2-bootstrap/#/pagination#pager-component)에서 구성 요소를 설정하는 것이 매우 간단 해 보입니다.각도 2로 페이지 매기기가 페이지 당 항목을 설정할 수 없습니다
그러나 페이지 당 항목을 설정할 수 없습니다. 그래서
PaginationModule.forRoot(),
같은 모듈이 내가 선택기를 추가 및 설명서와 같은 속성을
maxSize:number = 5;
bigTotalItems:number = 726;
bigCurrentPage:number = 1;
numPages:number = 0;
itemsPerPage: number = 10; // **** this is the one not working
이
<pagination
class="pagination-sm"
[totalItems]="bigTotalItems"
[(ngModel)]="bigCurrentPage"
[maxSize]="maxSize"
[boundaryLinks]="true"
[rotate]="false"
[itemsPerPage]="itemsPerPage"
(numPages)="numPages = $event">
</pagination>
모두가 표시되지만 표시에 필요한 속성을 추가 한 예제를 따라하고 수입 페이지는 10 개로 제한되지 않습니다. 모든 것이 한 페이지에 나타납니다. 노드 모듈/GitHub의 페이지에 대한 구성 요소에서
페이지 당 ( https://github.com/valor-software/ng2-bootstrap/blob/development/src/pagination/pagination.component.ts) 항목 내 매김 선택기 직접 장식*ngFor
이하임을 확인했다 그래서
this.itemsPerPage = typeof this.itemsPerPage !== 'undefined'
? this.itemsPerPage
: this.config.itemsPerPage;
과 같이 구성되어 왜 내가 items 페이지의을 올바르게 설정할 수 없는지 말할 수 없습니다.
'itemsPerPage : number = 10;'이 아니고 야간에 -1 – Habeeb
야간 타입이 아닙니다. 구성 요소의 구문이 정확합니다. 나는 위의 내 대답을 일치하도록 변경했습니다. – Winnemucca