I use ng-repeat, I did the unshift which adds a new item into a list. but I have problem with deleting an item.
this is console.log($scope.postItem)
and I tried this:
var itemsLength = $scope.postItem.length;
for(var i = 0; i < itemsLength; i++){
if($scope.postItem[i].post_id == get_post_id){
$scope.postItem.splice(i,1);
break;
}
}
it doesn't work because it removed the entire thing. I should be getting the index of the founded $scope.postItem[i] before splice.