Default sorting in Angular Material - Sort header

后端 未结 9 1335
执念已碎
执念已碎 2020-12-13 03:14

How can I change Angular Material code below, so that data-table is sorted by \'name\' column, ascending order by default. Arrow (indicating current sort direction) must be

9条回答
  •  [愿得一人]
    2020-12-13 03:59

    You're mistaking matSortStart for matSortDirection.

    Try this:

    https://plnkr.co/edit/sg0hC5d8LTjLKhbH9Eug?p=preview

    matSortStart can be used to reverse the cycle used when sort (e.g. when the user clicks to sort, it starts at desc instead of asc).

    提交回复
    热议问题