Answer the question
In order to leave comments, you need to log in
How to sort objects by date (ascending)?
Link to JSFiddle
How to sort objects by date ( ascending ) only those with var === true .
On the rest, sorting would not pay attention.
For example, through ng-repeat="arr in array | orderBy: 'date'". But this applies to all objects.
Answer the question
In order to leave comments, you need to log in
The easiest way is to make two different arrays and display them separately (if I understand correctly).
Let the original array, as in fiddle
original = [
{id: 1, name: 'test_1', date: '2018-12-9', var: true},
{id: 2, name: 'test_2', date: '2018-12-2', var: false},
{id: 3, name: 'test_3', date: '2018-12-6', var: true},
{id: 4, name: 'test_4', date: '2018-12-8', var: false},
{id: 5, name: 'test_5', date: '2018-12-10', var: true},
];
unsortedArray = original.filter( next => !next.var)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question