<div ng-app="animateApp" ng-controller="AnimateCtrl">
    <div">
        <super-ball ng-repeat="shape in shapes"
              x="shape.x" y="shape.y" color="shape.color" />
    </div>
    <a ng-click="add()">Push</a><a ng-click="remove()">Pop</a>
</div>
<script>
    angular.module('animateApp', []).directive('ball', function ($timeout) {
    return {
        restrict:'E',
        link:function (scope, element, attrs) {
            element.addClass('circle');
            scope.$watch(attrs.x, function (x) { element.css('left', x + 'px'); });
            scope.$watch(attrs.y, function (y) { element.css('top', y + 'px');  });
            scope.$watch(attrs.color, function (color) {
                         element.css('backgroundColor', color); });
        }
    };
});
  /* AnimateCtrl (Controlleur) */
  /* Alimentation de 'shapes' et animation des coordonnées */
</script>
        
Push Pop