Last active
November 15, 2015 22:10
-
-
Save uhtred/74ed2fe72350cb29781c to your computer and use it in GitHub Desktop.
sort-column.angular.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sortBy (column) { | |
| if( vm.sortColumn === column ) { | |
| vm.sortDsc = !vm.sortDsc; | |
| } else { | |
| vm.sortColumn = column; | |
| vm.sortDsc = false; | |
| } | |
| } | |
| function sortClass(column) { | |
| var classes = ''; | |
| if( vm.sortColumn === column ) { | |
| classes = vm.sortDsc ? 'fa-caret-up': 'fa-caret-down'; | |
| } else { | |
| classes = 'fa-caret-down sort-inactive'; | |
| } | |
| return classes; | |
| } | |
| /* | |
| <a href="" ng-click="vm.sortBy('amount')" class="full-link"> | |
| <i ng-class="vm.sortClass('amount')" class="fa"></i>Amount | |
| </a> | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment