You can fadeOut jQuery-cloned html element: http://jsfiddle.net/5JZPH/29/
HTML:
<div ng-app="test"> <input type="button" value=" + " ng-click="index = index + 1"/> <input ng-model="index" smooth="index" style="display:block"/> [{{index}}] </div>
JavaScript:
angular.module('test', []) .directive('smooth', function() { return { transclude: 'element', priority: 750, terminal: true, compile: function(element, attr, linker) { return function(scope, iterStartElement, attr) { var prevClone = null; scope.$watch(attr.smooth, function() { var newScope = scope; linker(newScope, function(clone) { if ( prevClone ) { newPrevClone = prevClone.clone(); prevClone.after(newPrevClone); prevClone.remove(); newPrevClone.fadeOut(2000, function() { $(this).remove() }); } iterStartElement.after(clone); prevClone = clone; }); }); } } }; })
Artem andreev
source share