Components: Can't bind to 'dataSource' since it isn't a known property of 'table'. ("<table mat-table

Created on 24 Jun 2018  路  8Comments  路  Source: angular/components

In Angular 6 with mat-table facing the error.

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

][dataSource]="dataSource" class="mat-elevation-z8">

My code has

I have tried using

I have included CdkTableModule, MatTableModule in main module.
But could not help resolving the issue.

package.json has below dependencies
"dependencies": {
"@angular/animations": "6.0.6",
"@angular/common": "6.0.6",
"@angular/compiler": "6.0.6",
"@angular/core": "6.0.6",
"@angular/forms": "6.0.6",
"@angular/http": "6.0.6",
"@angular/platform-browser": "6.0.6",
"@angular/platform-browser-dynamic": "6.0.6",
"@angular/router": "6.0.6",
"core-js": "2.5.7",
"rxjs": "6.2.1",
"zone.js": "0.8.26",
"moment": "2.22.2",
"hammerjs": "2.0.8",
"@angular/cdk": "6.3.0",
"@angular/material": "6.3.0",
"web-animations-js": "2.3.1",
"angular-in-memory-web-api": "0.6.0",
"@angular/material-moment-adapter": "6.3.0",
"@angular-devkit/core": "0.6.8",
"chalk": "^2.3.1",
"gulp": "^3.9.1",
"gulp-bump": "^2.7.0",
"ng-drag-drop": "^4.0.0",
"ngx-carousel": "^1.3.5",
"rxjs-compat": "^6.2.1",
"sass-loader": "^7.0.3"
}

Most helpful comment

This error means that you haven't added the MatTableModule to your module's imports.

still not working

All 8 comments

This error means that you haven't added the MatTableModule to your module's imports.

This error means that you haven't added the MatTableModule to your module's imports.

still not working

I am having this error, have done everything needed

What's going on guys?

you have to change "table" tag to "mat-table" .

it will solve your problem.

Make sure that your '*matHeaderRowDef' is equal to the keys in your 'dataSource'

I'm using a Mobx Store, so had to change to this:

<tr mat-header-row *matHeaderRowDef="storeModule.displayedColumns"></tr>

Solved the issue purely be accident!!!

We have no problem with typescript and syntax in angular. But kind of this problem, the plugins error, the etc etc....

This error means that you haven't added the MatTableModule to your module's imports.

I did the same mistake. Added the MatTableModule solved mine problem too. ;)

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';

import { FuseSharedModule } from '@fuse/shared.module';
import { FuseHighlightModule } from '@fuse/components';

import { QueriesComponent } from './queries.component';

import {MatTableModule} from '@angular/material/table';

const routes: Routes = [
{
path : 'queries',
component: QueriesComponent
}
];

@NgModule({
declarations: [QueriesComponent],
imports: [
CommonModule,
RouterModule.forChild(routes),
FuseSharedModule,
FuseHighlightModule,
MatTableModule
]
})
export class QueriesModule
{
}

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

Was this page helpful?
0 / 5 - 0 ratings