components icon indicating copy to clipboard operation
components copied to clipboard

Can't bind to 'dataSource' since it isn't a known property of 'table'

Open testengine999 opened this issue 6 years ago • 6 comments

ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'dataSource' since it isn't a known property of 'table'. ("

][dataSource]="dataSource" matSort>
<!-- ID Column -->

"): ng:///AdminLayoutModule/DashboardComponent.html@5:19 Can't bind to 'matHeaderRowDef' since it isn't a known property of 'tr'. ("

<tr mat-header-row [ERROR ->]*matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColu"): ng:///AdminLayoutModule/DashboardComponent.html@31:23

Property binding matHeaderRowDef not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("

[ERROR ->]<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; col"): ng:///AdminLayoutModule/DashboardComponent.html@31:4

Can't bind to 'matRowDefColumns' since it isn't a known property of 'tr'. ("

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row [ERROR ->]*matRowDef="let row; columns: displayedColumns;">
</tr>
"): ng:///AdminLayoutModule/DashboardComponent.html@32:16 Property binding matRowDefColumns not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
<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]">

"): ng:///AdminLayoutModule/DashboardComponent.html@36:17 'mat-paginator' is not a known element: 1. If 'mat-paginator' is an Angular component, 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. ("

[ERROR ->]<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]">

"): ng:///AdminLayoutModule/DashboardComponent.html@36:2 Error: Template parse errors: Can't bind to 'dataSource' since it isn't a known property of 'table'. ("
][dataSource]="dataSource" matSort>
<!-- ID Column -->

"): ng:///AdminLayoutModule/DashboardComponent.html@5:19 Can't bind to 'matHeaderRowDef' since it isn't a known property of 'tr'. ("

<tr mat-header-row [ERROR ->]*matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColu"): ng:///AdminLayoutModule/DashboardComponent.html@31:23

Property binding matHeaderRowDef not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("

[ERROR ->]<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; col"): ng:///AdminLayoutModule/DashboardComponent.html@31:4

Can't bind to 'matRowDefColumns' since it isn't a known property of 'tr'. ("

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row [ERROR ->]*matRowDef="let row; columns: displayedColumns;">
</tr>
"): ng:///AdminLayoutModule/DashboardComponent.html@32:16 Property binding matRowDefColumns not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
<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]">

"): ng:///AdminLayoutModule/DashboardComponent.html@36:17 'mat-paginator' is not a known element: 1. If 'mat-paginator' is an Angular component, 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. ("

[ERROR ->]<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]">

")

testengine999 avatar Jan 29 '20 12:01 testengine999

Can you also post your NgModule, it seems that you forgot to import MatTableModule to your NgModule.

tomicarsk6 avatar Jan 29 '20 13:01 tomicarsk6

It looks like you need to import the MatTableModule as @tomicarsk6 mentioned.

crisbeto avatar Jan 29 '20 20:01 crisbeto

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. Capture2

But Showing Error with ng serve Capture

testengine999 avatar Jan 31 '20 09:01 testengine999

Please post whole app.module.ts.

tomicarsk6 avatar Jan 31 '20 11:01 tomicarsk6

If you're using the table inside a lazy-loaded module you need to import it inside the lazy module as well.

crisbeto avatar Jan 31 '20 11:01 crisbeto

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.