Created
October 18, 2017 12:41
-
-
Save 360disrupt/1432ee1cd1685a0baf8967dc70ae14b1 to your computer and use it in GitHub Desktop.
OrderBy Filter Which Orders Empty Props Last
This file contains 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
angular.module 'tsd.orderByEmptyLast', [] | |
.filter 'orderByEmptyLast', ($filter) -> | |
return (list, predicate, reverse)-> | |
orderedList = $filter('orderBy')(list, if reverse then ['!' + predicate, '-' + predicate] else ['!' + predicate, predicate] ) | |
return orderedList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment