I succesfully applied the sort mechanism for my angular material design table but what I'm missing is that the table sorts itself when I load the page. It works when I click on the column header of the column I want to sort but not at startup. The only solution I can find is the (matSortChange) but I don't want to define a sort function because obviously angular knows the sort function but just does not apply it when the table is created. One problem I may be facing is that I create the dataSource empty because I add the data in the ngOnInit() function.
I also tried matSortActive="name" matSortDirection="desc" and the arrow is there but it is not sorted, maybe because I have only 0's at the beginning before changing the numbers. But I don't know how I could delay this.
Greetings