A simple and lightweight angular sort button component.
npm install angular-sort-button
angular.module('fancyStuffModule', [
'apinnecke.sort-button'
]);
or if you're using browserify of something like that:
angular.module('fancyStuffModule', [
require('angular-sort-button')
]);
<tr>
<th><sort-button order="order" value="city">City</sort-button></th>
<th><sort-button order="order" value="price">Price</sort-button></th>
<th><sort-button order="order" value="status">Status</sort-button></th>
<th><sort-button order="order" value="color">Color</sort-button></th>
</tr>
Parameter order
has two properties: order
(which contains the name from current ordering column) and reverse
(which contains the boolean flag, weather it is reverse or not).