Is it possible to manipulate and sort multiple column in angularjs filter 
orderBy?

*Fiddle <http://jsfiddle.net/br5sssv7/5/>*

*JS*

var myApp = angular.module('myApp', []);
function MyCtrl($scope, $filter) {
    var r = [
        {'group':1,'sub':1, 'date': '11/4/2014 2:01 PM'}, 
        {'group':2,'sub':10, 'date': '11/4/2014 4:36 PM'}, 
        {'group':1,'sub':2, 'date': '11/4/2014 8:59 AM'},
        {'group':1,'sub':20, 'date': '4/14/2015 5:54 PM'},
        {'group':2,'sub':1, 'date': '11/3/2014 9:09 PM'},
        {'group':2,'sub':11, 'date': '9/4/2014 2:48 PM'}
    ];

    $scope.mcards = $filter('orderBy')(r, [function(a){
        return -new Date(a.date).getTime(); 
        //manipulate the string and then sort it by ascending or descending 
order.
    }]);}

It is not working as expected whereas when I try it in the following way it 
works great,

$scope.mcards = $filter('orderBy')(r, ['group', function(a){
    return -a.sub;}]);

What is the problem here, am I missing something?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to