I have angular material table and search working ok...
Problem is,
I have route A
and in this route, I send value to the search box in table in route B
and they need automatically set filtered data in a table.
I correctly get this value in the table search box, but it's not applied to the table...if I manually add any letter or number, filter working properly
Here is component A
goToRouteB(id): void {
this.router.navigate(["/routeB"], { state: { data: id } }); //id: is some number
}
And here is component B
ngOnInit() {
if (history.state.data) { //history.state.data is passed id
this.searchKey = history.state.data;
this.dataSource.filterPredicate = function(data, filter: string): boolean {
return data.userId.toString() === filter;
};
}
}