我在锁定我的pc并让我的角项目运行时犯了错误,每次我忘记退出运行中的角项目时,我的控制台在解锁我的pc时都会出现以下错误:
ERROR in src/app/app.component.html:13:32 - error TS2339: Property 'myDataArray' does not exist on type 'AppComponent'.
13 <table mat-table [dataSource]="myDataArray">
~~~~~~~~~~~
src/app/app.component.ts:5:16
5 templateUrl: './app.component.html',
~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component AppComponent.
src/app/app.component.html:13:18 - error NG8002: Can't bind to 'dataSource' since it isn't a known property of 'table'.
13 <table mat-table [dataSource]="myDataArray">
~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/app.component.ts:5:16
5 templateUrl: './app.component.html',
~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component AppComponent.这种情况发生在多个例子中,我不知道为什么,我已经尝试重新启动我的pc并分析错误,但我还没有取得任何成功。
发布于 2020-07-29 18:41:49
这显然是一个未设置变量的问题。
从错误消息中检查您的app.component.html中指定的“席表”。
然后检查变量"myDataArray“是否实际上是app.component.ts的实例成员变量,以及它是否被正确设置(显示的元素数组)。
https://stackoverflow.com/questions/63160295
复制相似问题