'use strict';

app.directive('clickAndDisable', function() {
  return {
    scope: {
      clickAndDisable: '&'
    },
    link: function(scope, elem, attrs) {
      elem.bind('click', function() {
        elem.prop('disabled',true);
        scope.clickAndDisable().finally(function() {
          elem.prop('disabled',false);
        });
      });
    }
  };
});