Can't bind to 'totalItems' since it isn't a known property of 'pagination'
See original GitHub issuei 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:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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?
It’s fine 😃