question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't bind to 'totalItems' since it isn't a known property of 'pagination'

See original GitHub issue

i looked some solutions,but it dont work. here is my code:

//app.modules.ts,use PaginationModule

@NgModule({
  declarations: [
    AppComponent,
    IndexComponent,
    TipModalComponent,
    UserComponent
  ],
  imports: [
    BrowserModule,
    SharedModule,
    PaginationModule.forRoot(),
    ModalModule.forRoot(),
    RouterModule.forRoot(appRoutes)
  ],
  entryComponents: [
    TipModalComponent
  ],
  providers: [HeadTabService,UtilService,AuthGuardService,LoginService,HttpService],
  bootstrap: [AppComponent]
})

// app.routes,register async PersoncenterModule load

export const appRoutes = [
  {
    path:'',
    redirectTo:'personcenter',
    pathMatch:'full'
  },{
    path: 'personcenter',
    canActivate: [AuthGuardService],
    loadChildren: './personcenter/personcenter.module#PersoncenterModule'
  }
  ....
];

//PersoncenterModule,regist DrawListComponent

imports: [
    SharedModule,
    RouterModule.forChild(personcenterRoutes)
  ],
  declarations: [
    ...
    DrawListComponent,
    DrawingComponent
  ]

//SharedModule, common module

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    RouterModule,
    ReactiveFormsModule,
    HttpClientModule
  ],
  exports:[
    CommonModule,
    FormsModule, 
    ReactiveFormsModule,
    HeadTabComponent
  ],
  declarations: [
    HeadTabComponent
  ]
})

//DrawListComponent

export class DrawListComponent implements OnInit {
  public totalItems: number = 64;
  public currentPage: number = 4;
  public smallnumPages: number = 0;

  constructor() { }

  ngOnInit() {
  }
  public setPage(pageNo: number): void {
    this.currentPage = pageNo;
  }

  public pageChanged(event: any): void {
    console.log('Page changed to: ' + event.page);
    console.log('Number items per page: ' + event.itemsPerPage);
  }
}

//DrawList Html

<div>
....
    <pagination [totalItems]="totalItems" [(ngModel)]="currentPage" (pageChanged)="pageChanged($event)"></pagination>
</div>

// error

core.es5.js:1020 ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'totalItems' since it isn't a known property of 'pagination'. ("
      </tr>
    </table>
    <pagination [ERROR ->][totalItems]="totalItems" [(ngModel)]="currentPage" (pageChanged)="pageChanged($event)"></pagination>"): ng:///PersoncenterModule/DrawListComponent.html@34:16
'pagination' is not a known element:
1. If 'pagination' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
eyereancommented, Aug 23, 2017

You should always import the ngx-bootstrap modules on the module.ts file that includes the components in which you want to use said modules.

PS: can you also close the other (same) issues that you opened?

0reactions
valorkincommented, Aug 30, 2017

It’s fine 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't bind to 'totalItems' since it isn't a known property of ...
I miss that model file import ng-bootstrap import {NgbModule} from '@ng-bootstrap/ng-bootstrap';. and inside @NgModel import for root
Read more >
can't bind to x since it isn't a known property - You.com
I'm trying to include the server paging data-table into my project. I've got it working on version 0.12.0 without server paging, but just...
Read more >
ngx-pagination - npm
The simplest solution for pagination in Angular. ... Start using ngx-pagination in your project by running `npm i ngx-pagination`.
Read more >
[Best solution]-Angular2 - Pagination error - appsloveworld
Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'totalItems' since it isn't a known property of 'pagination'.
Read more >
Angular 10 Pagination example | ngx-pagination - BezKoder
ngx-pagination supports this scenario, so We actually only need to use tutorials and totalItems when working with this library. How to use ngx- ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found