Can't bind to 'dataSource' since it isn't a known property of 'table'
ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'dataSource' since it isn't a known property of 'table'. ("
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
[ERROR ->]<tr mat-row *matRowDef="let row; columns: displayedColumns;">
</tr>
"): ng:///AdminLayoutModule/DashboardComponent.html@32:4
Can't bind to 'pageSizeOptions' since it isn't a known property of 'mat-paginator'.
1. If 'mat-paginator' is an Angular component and it has 'pageSizeOptions' input, then verify that it is part of this module.
2. If 'mat-paginator' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
<mat-paginator [ERROR ->][pageSizeOptions]="[5, 10, 25, 100]">
[ERROR ->]<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]">
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
[ERROR ->]<tr mat-row *matRowDef="let row; columns: displayedColumns;">
</tr>
"): ng:///AdminLayoutModule/DashboardComponent.html@32:4
Can't bind to 'pageSizeOptions' since it isn't a known property of 'mat-paginator'.
1. If 'mat-paginator' is an Angular component and it has 'pageSizeOptions' input, then verify that it is part of this module.
2. If 'mat-paginator' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
<mat-paginator [ERROR ->][pageSizeOptions]="[5, 10, 25, 100]">
[ERROR ->]<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]">
Can you also post your NgModule, it seems that you forgot to import MatTableModule to your NgModule.
It looks like you need to import the MatTableModule as @tomicarsk6 mentioned.
I already imported in my app.module.ts but not working...
import {MatTableModule} from '@angular/material';
@NgModule({ imports: [ 'MatTableModule' ] });
My Angular Package below:
"dependencies": { "@angular/animations": "~8.2.14", "@angular/cdk": "~8.2.3", "@angular/common": "~8.2.14", "@angular/compiler": "~8.2.14", "@angular/core": "~8.2.14", "@angular/forms": "~8.2.14", "@angular/material": "^8.2.3", "@angular/platform-browser": "~8.2.14", "@angular/platform-browser-dynamic": "~8.2.14", "@angular/router": "~8.2.14", "hammerjs": "^2.0.8", "jquery": "^3.4.1", "perfect-scrollbar": "^1.5.0", "rxjs": "~6.4.0", "rxjs-compat": "^6.5.4", "tslib": "^1.10.0", "zone.js": "~0.9.1" },
Working fine with ng test like attached screenshots.
But Showing Error with ng serve
Please post whole app.module.ts.
If you're using the table inside a lazy-loaded module you need to import it inside the lazy module as well.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.