This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
digest issue with ng-form with validators on a ng-repeat when using ng-animate on 1.4.1 #12161
Closed
Description
When there is a ng-form directive on a ng-repeat directive, and there are validations in fields inside that form, the deletion of an element in the list is not reflected in the ng-repeat.
http://plnkr.co/edit/Er0thSHyCg0s2lvGO8SP
<div ng-controller="MyCtrl as myCtrl">
list length: {{myCtrl.list.length}}
<div ng-form ng-repeat="elt in myCtrl.list track by elt.id">
<input required ng-model="elt.text">
<button ng-click="myCtrl.deleteElt($index)">delete</button>
</div>
<button ng-click="myCtrl.addElt()">add</button>
</div>
(ng-form and ng-repeat are on the same element)
var app = angular.module('exampleApp', ['ngAnimate']);
var cpt = 0;
app.controller('MyCtrl', function ($scope, $element) {
this.list = [];
for (var i = 0; i < 6; ++i) {
this.list.push({
text: 'Elt ' + i,
id: ++cpt
});
}
var _this = this;
this.deleteElt = function (index) {
_this.list.splice(index, 1);
}
this.addElt = function (index) {
_this.list.push({
text: '',
id: ++cpt
});
}
});