2016-12-31 7 views
0

私はMeteor Angular 2チュートリアルで作業しています。流星プロジェクトの編集

client/imports/app/parties/parties-list.component.ts (6, 43): Module '"node_modules/ng2-pagination/index"' has no exported member 'PaginationControlsCmp'. 
    client/imports/app/parties/parties-list.component.ts (72, 37): Argument of type '{ id:() => string; itemsPerPage: number; currentPage: number; totalItems: number; }' is not assignable to parameter of type 'PaginationInstance'. 
     Types of property 'id' are incompatible. 
     Type '() => string' is not assignable to type 'string'. 
    client/imports/app/parties/parties-list.component.ts (86, 44): Argument of type '() => string' is not assignable to parameter of type 'string'. 
    cl 

問題を通じてバック働いて、私はgithubのフォーラムで見てきた一つのことは1行です:

import { PaginationService, PaginatePipe, PaginationControlsCmp } from 'ng2-pagination'; 

しかし、私は、この作品を作ることができていません。私は非常にこれに新しいので、私は問題を開始している場所にこれをトレースしようとしています。参照のためのコードを含む

EDITED

:私は、次を発見しました。

がインストールされた:

meteor npm install ng2-pagination --save 

が輸入:

import { Ng2PaginationModule } from 'ng2-pagination'; 

+┊ ┊11┊interface Pagination { 
+┊ ┊12┊ limit: number; 
+┊ ┊13┊ skip: number; 
+┊ ┊14┊} 
+┊ ┊15┊ 
+┊ ┊16┊interface Options extends Pagination { 
+┊ ┊17┊ [key: string]: any 
+┊ ┊18┊} 

+┊ ┊36┊ constructor(
+┊ ┊37┊ private paginationService: PaginationService 
+┊ ┊38┊ ) {} 

+┊ ┊65┊ this.paginationService.register({ 
+┊ ┊66┊  id: this.paginationService.defaultId, 
+┊ ┊67┊  itemsPerPage: 10, 
+┊ ┊68┊  currentPage: 1, 
+┊ ┊69┊  totalItems: 30, 
+┊ ┊70┊ }); 

...

+┊ ┊52┊  this.paginationService.setCurrentPage(this.paginationService.defaultId, curPage as number); 

そして最後に改ページ要素:

+┊ ┊17┊ <pagination-controls (pageChange)="onPageChanged($event)"></pagination-controls> 
enter code here 
I think I've done this all correctly, as per the tutorial, and altered as per the issues, but cannot get it working. 
私がこだわっているところ

これは、次のとおりです。(9月13日)

https://github.com/Urigo/meteor-angular2.0socially/blob/master/manuals/views/step13.md

+1

答えを追加しましたが、ここで銃を飛ばしたかどうかは分かりませんが、このモジュールをどこでどのように使用しているのかをコードに含めることができます。どのように宣言したのですか?どのように使用しましたか?エラーメッセージは十分ではありません。コードがどのようになっているか分かりません。 – Alex

+0

チュートリアルを添付しました。私はトップで取り組んでいますが、ページ番号にはリンクしていませんでした。私の間違い。 –

+0

これはまだ助けにはなりません、あなたはあなたのコードをどのようにインポートするのか、それをどのように使うのか、設定ファイルなのかなど、あなたのコードを見る必要があります。その包み。私は指示に従うことで推測しますが、とにかくステップを列挙します。多分あなた自身がエラーを見つけます;)コードスニペットが必要です。チュートリアルを使用していても、問題に関連するコードを表示して問題を解決できるようにしたいと考えています。 – Alex

答えて

0

私もngPaginationで働いているが、私は本当にあなたの輸入を理解していませんよ。これはおそらくあなたの問題を引き起こしているはずです。あなたがインポートできないものとインポートできないものをインポートしようとしているからです。あなたはそうのようなあなたの@NgModuleにインポートする必要があります。

import { Ng2PaginationModule } from 'ng2-pagination'; 

@NgModuleであなたのimportsでそれを宣言する:

imports: [Ng2PaginationModule ...+ your other imports] 

、その後、あなたは何をインポートせずに、あなたのコンポーネント(HTML)でそれを使用することができますあなたのコンポーネントは、すでにあなたの@NgModuleでそれを宣言しておりますので、そのように例えば:

<table> 
    <tr *ngFor="let item of array | paginate: {itemsPerPage: 10, currentPage: p }"> 
     <td>{{item.value}}</td> 
    </tr> 
</table> 

を210はあなたの選択の変数です。

希望すると便利です。