Darama Darama - 1 year ago 57
AngularJS Question

How to enable button Angular JS if file was selected?

I use this library for uploading files in Angular JS.

How can I enable submit button if file was selected?

I can get access to object:

var uploader = new FileUploader({})

Answer Source

Just check the length of queue property - this is an array with selected file(s).

JS:

$scope.uploader = new FileUploader({});

HTML:

<button type="button" ng-disabled="uploader.queue.length < 1">Upload</button>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download