Very simple question: In AngularJS 1.2.x it possible (and how) to get ngAnimate when an item is removed from scope?
Here is a Plunker example:
http://plnkr.co/edit/tpl:FrTqqTNoY8BEfHs9bB0f?p=preview
the code:
<body ng-controller="MainCtrl"> <div ng-repeat="img in imgs" class="my-repeat-animation"> <img ng-src="{{img}}" /> <button class="btn btn-primary" ng-click="remove(img)">DELETE</button> </div> </body>
Script:
app.controller('MainCtrl', function($scope) { $scope.imgs = ['http://cache.mrporter.com/images/products/362812/362812_mrp_in_l.jpg', 'http://cache.mrporter.com/images/products/362807/362807_mrp_in_l.jpg', 'http://cache.mrporter.com/images/products/364762/364762_mrp_in_l.jpg', 'http://cache.mrporter.com/images/products/357020/357020_mrp_in_l.jpg'] $scope.remove = function(image){ var index = $scope.imgs.indexOf(image); $scope.imgs.splice(index,1); } });
As you can see, pressing the DELETE button launches splice() on $scope.imgs . I would like to revive it, and not just disappear. I use transitions only copied and pasted from this year 's article in Moo , which works fine when filtering a scope, but obviously not when deleting from a scope.
javascript angularjs ng-animate angularjs-animation
Jascination
source share