I would like to pick up a file with AngularJS:
HTML:
Directive that uses the ng-model-controller:
app.directive("selectNgFiles", function() {
return {
require: "ngModel",
link: function postLink(scope,elem,attrs,ngModel) {
elem.on("change", function(e) {
var files = elem[0].files;
ngModel.$setViewValue(files);
})
}
}
});
Usage:
For more information, see Working Demo of Directive that Works with ng-model.