ng2-pagination Angular 2

时间:2017-03-02 15:15:03

标签: angular pagination

我正在使用ng2-pagination为我的angular 2应用程序实现分页。我正在关注如何执行此操作的基本教程,但我收到了以下错误

错误:

  

reflection_capabilities.js:58 Uncaught TypeError:ctorParameters.map是   不是一个功能

组件

              @Input('data') Country: string[] = [];
                    page: number = 1;

             <tbody>
                <tr *ngFor="let key of Country | keys paginate:{itemsPerpage: 10 , currentPage: page};  let i = index" >
                  <td>{{Country[key].location}}</td>
                  <td>{{Country[key].map}}</td>



         </tr>

              </tbody>
                <div class="has-text-centered">
                    <pagination-controls (pageChange)="page = $event"></pagination-controls>
                </div>

//package.json
{
  "name": "project",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~2.1.0",
    "@angular/compiler": "~2.1.0",
    "@angular/core": "~2.1.0",
    "@angular/forms": "~2.1.0",
    "@angular/http": "~2.1.0",
    "@angular/platform-browser": "~2.1.0",
    "@angular/platform-browser-dynamic": "~2.1.0",
    "@angular/router": "~3.1.0",
    "@types/lodash": "^4.14.50",
    "angular-2-data-table": "^0.1.2",
    "angular2-datatable": "^0.5.2",
    "core-js": "^2.4.1",
    "lodash": "^4.17.4",
    "ng2-date-picker": "^0.2.1",
    "ng2-file-upload": "^1.1.2",
    "ng2-modal": "0.0.24",
    "ng2-pagination": "^2.0.1",
    "primeng": "^1.1.4",
    "rxjs": "5.0.0-beta.12",
    "tinymce": "^4.5.2",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.18",
    "codelyzer": "1.0.0-beta.1",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "~2.0.3"
  }
}

1 个答案:

答案 0 :(得分:0)

您的Angular版本已经过时,最新版本的ng2-pagination支持2.3.0+。所以只需将@angular版本从2.1.0更改为2.3.0