Hey everyone, I'm facing a situation where I have an array of objects in the database. I used $http.get to retrieve this data and I understand that it returns as a promise, which means I can't directly use push() or forEach(). However, I really need to utilize these methods with the array. One solution could be transferring the values to another array and then applying the desired methods. How should I go about solving this? Thanks
$http.get('/api/itens').success(function(itens){
$scope.itens= itens;
socket.syncUpdates('itens', $scope.itens);
});
var arr = []
$scope.itens.forEach(function(value){
arr.push(value.name);
});