简体   繁体   中英

ng2-pagination Angular 2

I am implementing pagination using ng2-pagination for my angular 2 app. I am following a basic tutorial on how to do this but i get an the error below

Error:

reflection_capabilities.js:58Uncaught TypeError: ctorParameters.map is not a function

Component

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

table

             <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"
  }
}

Your version of Angular is to old, the latest version of ng2-pagination supports 2.3.0+. So just change your @angular versions from 2.1.0 to 2.3.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM