我想在我的应用程序上添加Angular Material Paginator.
在模块中添加了MatPaginatorModule.
<mat-paginator #paginator [length]="100" [pageSize]="10" [pageSizeOptions]="[5,10,25,100]"> </mat-paginator>
但它给出了一个错误:
未捕获错误:模板解析错误:
无法绑定到’length’,因为它不是’mat-paginator’的已知属性.
>如果’mat-paginator’是一个Angular组件并且它有’length’输入,那么请验证它是否是该模块的一部分.
>如果’mat-paginator’是Web组件,则将’CUSTOM_ELEMENTS_SCHEMA’添加到此组件的’@NgModule.schemas’以禁止显示此消息.
也许我错过了什么?
"@angular/animations": "^5.0.1","@angular/cdk": "^5.0.0-rc0","@angular/common": "^5.0.0","@angular/compiler": "^5.0.0","@angular/core": "^5.0.0","@angular/forms": "^5.0.0","@angular/http": "^5.0.0","@angular/material": "^5.0.0-rc0",
为了防止其他人遇到此问题,只需在app.module.ts中导入模块即可
import { MatPaginatorModule } from '@angular/material';
和
@NgModule({ ... imports: [ .... MatPaginatorModule ]