I have a controller which has the test array and I have added 2 objects to it. When I call delete function from html ng-click, the array is not updated in dom but I can see that the array being spliced in js code. I have tried $apply(), but that does not work as it says it is already applied.
app.controller('HomeCtrl', ['$rootScope', '$scope', function($rootScope, $scope) {
var person1 = {firstName:"John", lastName:"Doe", age:46};
var person2 = {firstName:"Joe", lastName:"Horn", age:66};
$scope.test = [];
$scope.test.push(person1);
$scope.test.push(person2);
$scope.deletePost = function(value, post){
$scope.test.splice(0, 1);
}
}]);
HTML:
<div class="row" ng-controller="HomeCtrl">
<div ng-repeat="tes in test">{{tes.age}}<br></div>
</div>
<a data-toggle="modal" ng-click="deletePost(value, post)" data-target="#deleteModal" ng-show="post.user.email == user.email" style="font-size:15px;margin-left: 1rem;" class="card-link" href="javascript:void(0)">Delete</a>