JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.angularjs.org/1.0.5/angular.js"></script>
<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;
});
});
}
}
};
})