【发布时间】:2021-05-12 19:54:33
【问题描述】:
我有一个应用调用观察器,由一个组件/服务组成。 我有一个简单的表格,可以正确显示为空
<table mat-table [dataSource]="this.getWatcherTable()" class="mat-elevation-z8">
... my columns and rows are described here
</table>
源链接到我的组件文件
export class WatcherComponent{
constructor(public watcherService : WatcherService ) {}
getWatcherTable(){
return this.watcherService.watcherTable;
}
}
本身链接到服务文件
export class WatcherService {
watcherTable : Array<Watcher> = new Array();
updateWatchers(name,value){
this.watcherTable.push({name:name, value:value});
}
}
更新由另一个应用程序触发并且运行良好,数组的控制台日志有更新,但数组仍然显示为空
【问题讨论】:
标签: angular typescript mat-table