Skip to content

Instantly share code, notes, and snippets.

@ivoputzer
Created October 25, 2014 23:25
Show Gist options
  • Save ivoputzer/411acbfd3f9c36108a88 to your computer and use it in GitHub Desktop.
Save ivoputzer/411acbfd3f9c36108a88 to your computer and use it in GitHub Desktop.
applying `ngFile.js` but pushing files to model
.directive('ngFile', ['$parse', function($parse){
return {
restrict: 'A',
require: 'ngModel',
link: function($scope, $element, attrs){
$element.bind('change', function(event){
$scope.$apply(function($scope){
Array.prototype.push.apply($parse(attrs.ngModel)($scope), event.target.files || [])
})
})
}
}
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment