I have an array like this:
$scope.emails = [
{"key":"Work","value":"user@domine.com"},
{"key":"","value":""},
{"key":"Work","value":"user2@domine.com"}
{"key":"","value":""}];
So, I want to remove empty emails but angular forEach
method removing only one object that is last object why???.
js code
angular.forEach($scope.emails, function(email, index){
if(email.value ===""){
$scope.emails.splice(index, 1);
}
});
where I am doing wrong