HTML:
After updating to AngularJS 1.2.x the snippet looks not working properly anymore and the file input doesn't sticks with the selected file value, making the form unusable.
Changing the directive back to your original one, and removing the ngModel.$render() it looks working like a charm:
.directive('validFile', function () {
return {
restrict: 'A',
require: '?ngModel',
link: function (scope, el, attrs, ngModel) {
el.bind('change', function () {
scope.$apply(function () {
ngModel.$setViewValue(el.val());
});
});
}
};