例如:一个对象数组arr :对文件路径字段值(filePath)含有“程序包”字符串进行排序;
function bubbleSort(){
var newArr = [];
angular.forEach(arr,function(item){
if(item.filePath.indexOf('程序包')>-1){
newArr.unshift(item);
}else{
newArr.push(item);
}
});
return newArr;
}
例如:一个对象数组arr :对文件路径字段值(filePath)含有“程序包”字符串进行排序;
function bubbleSort(){
var newArr = [];
angular.forEach(arr,function(item){
if(item.filePath.indexOf('程序包')>-1){
newArr.unshift(item);
}else{
newArr.push(item);
}
});
return newArr;
}