Array.prototype.unique3 = function(){ //数组去重
var res = [];
var json = {};
for(var i = 0; i < this.length; i++){
if(!json[this[i]]){
res.push(this[i]);
json[this[i]] = 1;
}
}
return res;
}
$scope.selectedShops=$scope.selectedShops.unique3();
js 数组遍历
for(j in $scope.aggShops){
if ($scope.aggShops[j].siteId != "ALL") {
$scope.siteIds.push($scope.aggShops[j].siteId);
};
}
2222222222222
$scope.aggShops.forEach(function(e){
if (e.siteId != "ALL") {
$scope.siteIds.push(e.siteId);
};
console.log(e);
})