我尝试通过选择下拉框中的项目来刷新我的组件
<select (change)="onChangePerPage($event.target.value)">
<option *ngFor="let perPage of perPages" [value]="perPage" [selected]="perPage===currentPerPage">{{ perPage }}</option>
</select>
在下拉框中选择项目时触发的事件将更新this.currentPerPage
onChangePerPage(perPage)
{
this.currentPerPage=perPage;
this.updatePagesCount();
}
并将更新this.nPages
updatePagesCount()
{
this.nPages=Math.floor(this.settings.options.pagination.count/this.settings.options.pagination.current);
if(this.settings.options.pagination.count % this.settings.options.pagination.current>0)
this.nPages++;
}
我希望这个更新基于nPages beeign修改:
<div *ngFor="let page of _.range(nPages)" (click)="gotoPage(page)" class="paginationPageDiv" [class.paginationActiveDiv]="page==currentPage">{{ page+1 }}</div>
但组件中的任何内容都不会刷新
请帮助