currently i am getting objects value in $scope.validuser but i want this into array form how do i store object value to array i jst want to store $scope.validuser into array i.e array[object]
$scope.sportIds = []; angular.forEach($scope.users, function(value, key){ $scope.sportIds[value.sport_id] = value.sport_id; if($scope.sportIds[value.sport_id] == 3){ $scope.validuser = value; } });
{id: 42, name:'Jimmy', age: 27}
. What should the array contain?$scope.validuser
to be an array, including the value at each index - right?