我想找到哪个更好的方法在数组中找到一个值? 当我使用$ filter有时它不能正常工作。
1:
for (j = 0; j < $scope.tips.length; j++) {
if ($scope.tips[j]["mid"] == cft.mid &&
$scope.tips[j]["oid"] == cft.tips[inx].oid &&
$scope.tips[j]["ot"] == cft.tips[inx].ot) {
$scope.tips.splice(j,1);
}
}
2:
var found2 = $filter('filter')($scope.tips, {mid: xmid, oid:xoid, ot:xot}, true)
if(found2.length) {
$scope.tips.splice(found2.index, 1)
}