I have an array source with nested arrays DataRows with no property name like that:
$scope.arraySource = [
["21", "Leon", "Blue"],
["15", "Marcel", "Red"],
["14", "Jason", "Yellow"],
["25", "Luc", "Green"],
["74", "Cyrile", "Black"],
["45", "John", "Grey"],
["21", "Etiennes", "Green"],
["58", "Mario", "Pink"],
["56", "Sylvain", "Blue"],
["87", "John", "White"]
];
I would like use it in a ng-repeat and to order that data from the first, the second or the third property.
I would like to order by index of datasource and not by propertyName
It would be something like that:
<select ng-model="indexForSort"
ng-select="idx for idx in [0,1,2]">
</select>
<table>
<tr ng-repeat="row in arraySource |
orderBy: indexForSort">
<td>row[0]</td>
<td>row[1]</td>
<td>row[2]</td>
</tr>
</table>
if the user select 0 in dropdown list, it will sort table by age, if he select 1, it will sort by Name if he select 2, it will sort by Color
Do you know how to do this please?