(function() { "use strict"; angular.module('shared') .directive("photoUpload", ['$parse', function($parse) { return { restrict:'A', link: function(scope, element, attributes) { var model = $parse(attributes.photoUpload); element.bind("change", function() { scope.$apply(function(){ model.assign(scope, element[0].files[0]); }); }); } } } ]); })();