'use strict';

app.directive('addToList', function (){
  return {
    restrict: 'A',
    scope: {
      fn: '&',
      list: '='
    },
    link: function(scope, element, attrs, ctrl) {
      element.on('click', function(event) {
        scope.$apply(function() {
          scope.list.push(scope.fn());
        });
      });
    }
  };
});