valor-software / ng2-table

Simple table extension with sorting, filtering, paging... for Angular2 apps
http://valor-software.github.io/ng2-table/
MIT License
553 stars 335 forks source link

Pagination not worrking #492

Open iouakrim opened 7 years ago

iouakrim commented 7 years ago

Hi , I'm trying to use ng2-table in my project but i get this error in browser console :

Unhandled Promise rejection: Template parse errors: Can't bind to 'totalItems' since it isn't a known property of 'pagination'. (" class="pagination-sm" [(ngModel)]="page" [ERROR ->][totalItems]="length" [itemsPerPage]="itemsPerPage" [maxSize]="maxSize"

eronalves commented 7 years ago

Add to imports FormsModule

https://github.com/valor-software/ng2-bootstrap/issues/1757

iouakrim commented 7 years ago

Tank you very much , it solve the problem

iouakrim commented 7 years ago

the problem was solved by adding .forRoot(), to PaginationModule in imports

abiezerm commented 7 years ago

who should close this?

bmannava-invn commented 7 years ago

I didn't find PaginationModule import {Ng2TableModule} from 'ng2-table/ng2-table'; import { NgTableComponent, NgTableFilteringDirective, NgTablePagingDirective,NgTableSortingDirective } from 'ng2-table/ng2-table';

@NgModule({ imports: [ CommonModule, FormsModule, NgaModule, TreeModule, Ng2TableModule, FormsModule, routing ], declarations: [ Components, Metrics, UserProfile ]

bmannava-invn commented 7 years ago

Nothing to do with FormsModule, it requires ng2-bootstrap && PaginationModule.forRoot() at imports.

import {Ng2TableModule} from 'ng2-table/ng2-table'; import { PaginationModule } from "ng2-bootstrap/pagination"; // from ng2-bootstrap @NgModule({ imports: [

Ng2TableModule,
PaginationModule.forRoot(),

],