I have a table to show records. One of it's columns contains select, to choose the version of the record. The second one is the map of dates, where keys are the versions. This looks like this:
<td><select ng-model="record.currentVersion"> ...</td>
<td>{{record.dates[record.currentVersion]}}
I'd like to add sorting by the second column's value, but I'm not sure how to address object's own property in st-sort. Something like st-sort="dates[currentVersion]" doesn't work. Is this possible to do?
Define a new function:
$scope.getDate = function(record) {
return record.dates[record.currentVersion];
};
Use st-sort
:
<th st-sort="getDate">Date</th>