I am looking to understand how to effectively utilize the Angular orderBy filter with a custom sorting function that places undefined values at the end.
For numeric sorting, my code looks like this:
<tr ng-repeat="item in items | handleEmptyValues(sortOptions):sortOptions.reverse)">
In the controller:
handleEmptyValues (sortOptions) {
const appendLast = sortOptions.reverse
? Number.MIN_SAFE_INTEGER
: Number.MAX_SAFE_INTEGER;
return (item) => (item.property) || appendLast;
}
My question is, how can I achieve the same functionality for sorting strings?
Many thanks!