I am using Angular Material Table that is backed by a plain array as the data source.
this.employees = this.route.snapshot.data.employes; // of type Employee[] resolved using a Resolve guard
this.dataSource = new MatTableDataSource<Employee>(this.employees);
Once rendered initially, I want to add/remove rows from the data table by modifying the 'this.employess' array using method in my component :-
addEmployee(e: Employee){
this.employess.push(e); // I expect the table to have one row added after this.
}
removeEmployee(index : number){
// splice the array at given index & remove one row from data table
}
PROBLEM
The data table rows are not affected when I add remove elements in my array. I found an a blog elaborating same problem but uses a custom data source. Is there any way using plain array ?
