AngularJS sorting rows by table header

后端 未结 9 1932
旧巷少年郎
旧巷少年郎 2020-12-04 07:08

I have four table headers:

$scope.headers = [\"Header1\", \"Header2\", \"Header3\", \"Header4\"];

And I want to be able to sort my table by

9条回答
  •  猫巷女王i
    2020-12-04 07:50

    Use a third-party JavaScript library. It will give you that and much more. A good example is datatables (if you are also using jQuery): https://datatables.net

    Or just order your bound array in $scope.results when the header is clicked.

提交回复
热议问题