2017-07-27 10 views
1

現在、私は現在、Spring MVCとAngularを使用してサーバーからのデータをページのに取得していますが、変更を試みると問題が発生します。ページ。サーバーサイドページネーション[Spring MVC&Angular 4]

プロフィール-management.component.html

   <tr 
       *ngFor="let profil of profilList | paginate: { id:'profils_pages', itemsPerPage: pageSize, currentPage: p, totalItems: totalObjectCount } "> 
       <td><a (click)="onSelect(profil)" data-toggle="modal" data-target="#myModal2" 
        style="text-decoration: none; cursor: pointer">{{profil.eprLabel}}</a> 
       </td> 
       <td> 
       <button type="submit" class="ti-pencil" (click)="onSelectUpdate(profil)" data-toggle="modal" 
         data-target="#myModal"></button> 
       </td> 
       <td> 
       <button type="submit" class="ti-trash" data-toggle="modal" data-target="#deleteModal" 
         (click)="onSelect(profil)"></button> 
       </td> 
      </tr> 
      <div style="text-align: center; margin-left: 35%; margin-top: 3%;"> 
       <pagination-controls id="profils_pages" 
            maxSize="10" 
            (pageChange)="p = getServerData($event)" 
            directionLinks="true" 
            autohide="true"> 
       </pagination-controls> 

私はこの問題は、getServerData(イベント)

プロフィール-management.component.ts

getServerData(event) { 
    this.profilManagementService.getProfilsPagination(event - 1).subscribe(
    res => { 
    this.profilList = res.json().ecomProfils; 
    }, error => { 
    } 
    ); 
} 
であると思います

enter image description here

enter image description here

改ページのカーソルは、それがサーバーから2番目のページをもたらし、まだ変更されません。

このコードでは、ngx-paginationを使用しています。

答えて

0

"getServerData"関数からイベントを戻す必要があります。イベントはpagination-controls指令のp変数に代入されているページ番号だけです。

関連する問題