0
我正在使用Meteor Angular 2 Tutorial。编译流星项目
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上论坛是一个行:
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
增加了一个答案,不知道我是否在这里跳过枪...但是你能否包括你的代码在哪里以及如何使用这个模块。你在哪里以及如何声明它,你是如何使用它的。向我们展示错误信息是不够的,因为我们不知道你的代码是怎么样的! – Alex
我附上我在顶部工作的教程,但没有链接到页码。我的错。 –
这仍然无法帮助,我们需要查看您的代码,例如,如何导入它,如何使用它,可能是配置文件,但是我们首先介绍如何导入它,以及如何安装它们包裹。我想按照说明操作,但无论如何都要列出步骤,也许你会发现一个错误;)我们需要代码片段。即使您正在使用教程,我们也希望看到与您的问题相关的相关代码,以便能够解决问题(如果可以的话)。 – Alex