私はテーブルがあるcomponent
のAngular2
アプリを持っています。 テーブルは*ngFor
ディレクティブによって生成されます。 table
の各行は、コンポーネントの初期化時にバックエンドからロードされている9個のフィールドを持つオブジェクトです。 私は角度モジュールにng-bootstrapを使用しようとしています。 ng-boorstrap 特に、pagination
コンポーネントを実装しようとしています。角度2 ngbページネーションにブートストラップ4を実装する方法
誰かがコードをどのように記述すればそれをレンダリングするか説明できますか? 1ページあたり10行しかない?または実装が行われた参照を私に教えてください。
私が行っていることである。
- 私は私のコンポーネントだけでなく、(カスタムページネーションを使用するために必要な)
NgbPaginationConfig
モジュールを宣言しています、私のモジュールへNgbModule
の参照を入れて を置きますこの
<table class="table table-striped"> <thead> <tr> <th>Tracking #</th> <th>Brand</th> <th>Geography</th> <th>Country</th> <th>Contract Name</th> <th>Project Name</th> <th>Status</th> <th>$US BMC</th> <th>Release #</th> <th id="column-last"></th> </tr> </thead> <tbody> <tr *ngFor="let item of viewRows "> <td>{{item.trackingNr}}</td> <td>{{item.brand}}</td> <td>{{item.geo}}</td> <td>{{item.country}}</td> <td>{{item.contractName}}</td> <td>{{item.projectName}}</td> <td>{{item.status}}</td> <td>{{item.usBmc}}</td> <td>{{item.releaseNr}}</td> <td id="column-last"> <span class="awficon-edit" id="row-icons"></span> <span class="awficon-close-2" id="row-icons"></span> </td> </tr> </tbody>
のような私
component
の観点ngb-pagination
コード
コンポーネントのドキュメントには、あなたがカバーした重要な詳細がありません。ありがとうございました。 –
どのように前のページを取得していますか?私はどんなタイプも見ています。あなたが値を割り当てている場所はありません。 – Winnemucca
routerResolverでパラメータを取得します。例えば、 '' 'resolve(route:ActivatedRouteSnapshot、state:RouterStateSnapshot){ const page = route.queryParams ['page']? route.queryParams ['page']: '1'; const sort = route.queryParams ['sort']? route.queryParams ['sort']: 'id、asc'; return { ページ: }; } '' ' –