<div class="col-md-2">
<md-button class="md-raised md-primary" ng-click="deleteDiv()">Remove</md-button>
</div>
scope.deleteDiv = function() {
alert(scope.itemsToAdd.length);
if(scope.itemsToAdd.length > 1) {
scope.itemsToAdd.splice(scope.itemsToAdd.length,1)
}
};
Hi.I am new to AngularJs.I have a doubt on removing a dynamically created div. itemsToAdd is an array which contains four fields.I add those fields dynamically using push and ng-repeat.When Remove button is clicked I get the length of the array and only delete if it is greater than 1. The removing procedure I posted,Is is correct? where am i doing wrong?.Thanks