mat-table can't bind dataSource

本秂侑毒 提交于 2019-12-18 09:38:50

问题


I am trying to use angular material table MatTableModule, but when passing the data to the [dataSource] input I am getting the Can't bind to 'dataSource' since it isn't a known property of 'table'. error. I have already imported the MatTableModule and as pointed at GitHub issue #5577 also imported CdkTableModule but still no luck. Any ideas?


回答1:


The problem was that the material angular version I'm using is v5.2.4, so the template should be <mat-table #table [dataSource]="dataSource"></mat-table> instead of <table mat-table #table [dataSource]="dataSource"></table> according to Angular material v5.2.4 documentation. https://v5.material.angular.io/components/table/overview#1-write-your-mat-table-and-provide-data



来源:https://stackoverflow.com/questions/50298241/mat-table-cant-bind-datasource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!