var SelectedOptionId = 957;
$scope.array = [{"957":"1269"},{"958":"1265"},{"956":"1259"},{"957":"1269"},{"947":"1267"}]
Is there a method to verify the existence of a value within an array of objects like this using Angular and underscore?
I've attempted the following approaches:
if ($scope.array.indexOf(SelectedOptionId) === -1) {console.log('already exists')}
as well as
console.log($scope.array.hasOwnProperty(SelectedOptionId)); //returns false
and
console.log(_.has($scope.array, SelectedOptionId)); //returns false