/**
 * Sets the 'filePresent' value on the scope if a file on the marked <input type="file"> exists.
 */
angular.module('quay').directive("filePresent", [function () {
  return {
    restrict: 'A',
    scope: {
      'filePresent': "="
    },
    link: function (scope, element, attributes) {
      element.bind("change", function (changeEvent) {
        scope.$apply(function() {
          scope.filePresent = changeEvent.target.files.length > 0;
        });
      });
    }
  }
}]);