Closed campa closed 7 years ago
Did you import CdkTableModule
?
I missed it !!it is solved thanks
Did you import MatTableModule
?
using <mat-table>
instead <table mat-table>
According to the material docs, using <mat-table>
instead of <table mat-table>
introduces this note
Note that this approach means you cannot include certain native-table features such colspan/rowspan or have columns that resize themselves based on their content
So yeah, using display: flex and <mat-table>
does work for me, but I would still like my columns to resize
Same for me.
I have both the CdkTableModule
, MatTableModule
and MatSortModule
in my module imports. It seems to work when I have
Fixed using <mat-table>
instead of <table mat-table>
like @minhquan2904 said.
@atertel-synexxus You are probably using version 5?! Have a look at this Stackoverflow thread.
Angular Core v6.0.2, Angular Material, v6.0.2, Angular CLI v6.0.0 (globally v6.1.2)
I had this issue when running ng test
, so to fix it, I added to my xyz.component.spec.ts
file:
import { MatTableModule } from '@angular/material';
And added it to imports
section in TestBed.configureTestingModule({})
:
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [ ReactiveFormsModule, HttpClientModule, RouterTestingModule, MatTableModule ],
declarations: [ BookComponent ],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
.compileComponents();
}));
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.
Bug
compiler.es5.js:1689 Uncaught Error: Template parse errors: Can't bind to 'dataSource' since it isn't a known property of 'md-table'.
What is the expected behavior?
no errors
What is the current behavior?
compiler.es5.js:1689 Uncaught Error: Template parse errors: Can't bind to 'dataSource' since it isn't a known property of 'md-table'.
What are the steps to reproduce?
I'm using your examples as code https://material.angular.io/components/table/overview
What is the use-case or motivation for changing an existing behavior?
migrating from ngx-... another nto official component for the table.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Is there anything else we should know?
node 6.11 LTS, npm 5.1
Thanks