$scope.input.sort(compare('ticked','name'));
var compare = function(ticked, name){
return function(a,b){
var t1 = a[ticked];
var s1 = a[name];
var t2 = b[ticked];
var s2 = b[name];
if(t1){
if(t2){
return s1.localeCompare(s2);
}else{
return -1;
}
}else{
if(!t2){
return s1.localeCompare(s2);
}else{
return 1;
}
}
}
}

  

 	$scope.input =[{
name: 'Draw1',
ticked: true
},
{
name: 'Draw2',
ticked: false
},
{
name: 'Draw3',
ticked: true
}
];

  

05-08 08:27