I
I
Ilya Ijyan2016-07-28 11:11:42
Angular
Ilya Ijyan, 2016-07-28 11:11:42

Sorting orderBy on a simple array of values?

It would seem a simple task, but everywhere in the examples sorting an array of objects.
I need to sort a simple array of values. Here is an example:

function TodoCtrl($scope) {
  $scope.todos = [ 3, 5, 1, 8, 2 ];   // Простые числа
}

Below - orderBy: item - doesn't work.
<div ng-app>
  <div ng-controller="TodoCtrl">
    <div ng-repeat="item in todos | orderBy: item">  /* Как отсортировать числа ?  */
      <p> {{item}} </p>
    </div>
  </div>
</div>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question