is it possible to use orderBy with something other than strings and numbers?
I have a list of customers and one of the columns contains an array of values (list of urls). I want to order by the url list, i.e. the first url in the list.
I thought the array would maybe be automatically converted to a string. I also tried using providerUrls[0] as orderBy criteria.
I know I could write my own sorting function but if there is a simple solution for this I would like to learn how to use it.
This is a reduced example of my code:
<table>
<thead>
<tr>
<td>
<p data-ng-click="sortBy = providerUrls; sortReverse = !sortReverse;">
URLs
<span data-ng-show="sortBy === providerUrls && !sortReverse">
<img src="arrow-down.svg"/>
</span>
<span data-ng-show="sortBy === providerUrls && sortReverse">
<img src="arrow-up.svg"/>
</span>
</p>
</td>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="provider in providerFilter = (providers | orderBy:sortBy:sortReverse) track by $index">
<td>
<p data-ng-repeat="url in provider.urls track by $index">
{{url}}
</p>
</td>
</tr>
</tbody>
</table>
My data structure:
var a = {
providerId: "a",
providerUrls: ["abc", "def", "ghi"]
// more properties
};
// b and c similar
$scope.providers = [a, b, c];