Angular Material mat-table is not showing updated data from data source
Reference to dataSource remains the same so that material doesn't know that your source changed.
Try
this.dataSource = [...this.data];
Forked Stackblitz
Or use BehaviorSubject
like:
dataSource = new BehaviorSubject([]);
onAdd($event){
this.data.push({name: this.currentText});
console.log(this.data);
this.dataSource.next(this.data);
}
Forked Stackblitz
Instead of push use concat to let table know that you modified the object
this.data = this.data.concat([{name: this.currentText}]);