I use an Angular directive for input file with file type, but input variable is undefined.
angular.directive("ngUpload", function() {
return {
restrict : "A",
template : '<input id="fileInput" name="file" type="file" class="ng-hide" multiple><md-button id="uploadButton" class="md-raised md-primary"> Choose Files </md-button>',
link : function (scope, element, attrs) {
var input = element.find('#fileInput');
var button = element.find('#uploadButton');
if (input.length && button.length) {
button.click((e) => input.click());
}
},
};
});