Skip to content

Instantly share code, notes, and snippets.

@idleworx
Created October 30, 2014 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idleworx/ea7e4445c8d44b376f45 to your computer and use it in GitHub Desktop.
Save idleworx/ea7e4445c8d44b376f45 to your computer and use it in GitHub Desktop.
Sorting by {{toggles.sort.itemsSort.column}}, reverse = {{toggles.sort.itemsSort.reverse}}.
<br>
<table class="table table-striped" ng-if="items.length > 0">
<thead>
<tr>
<th ng-repeat="field in getFieldsSorted(items[0])" ng-click="toggles.sort.itemsSort.column='fields.'+field.name+'.value';toggles.sort.itemsSort.reverse=!toggles.sort.itemsSort.reverse;">
{{field.description}}
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="i in items">
<td ng-repeat="field in getFieldsSorted(i)">
{{field.value}}
</td>
</tr>
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment