Skip to content

Instantly share code, notes, and snippets.

@ray-peters
Created March 4, 2016 20:25
Show Gist options
  • Save ray-peters/565ded3338e8e399cda8 to your computer and use it in GitHub Desktop.
Save ray-peters/565ded3338e8e399cda8 to your computer and use it in GitHub Desktop.
Fix for ng-file-upload - Create and segment invalids via an error blacklist. Do not mark files invalid because of maxLength.
function separateInvalids() {
var skipErrors = [ "maxFiles" ];
valids = [];
invalids = [];
angular.forEach(allNewFiles, function (file) {
if (file.$error) {
if ( skipErrors.indexOf( file.$error ) !== -1 ) return;
invalids.push(file);
} else {
valids.push(file);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment