Angular directive to allow ng-model to be used in file inputs
npm i angular-file-input --save
<script src="node_modules/angular/angular.js"></script>
<script src="node_modules/angular-file-input/dist/angular-file-input.js"></script>
angular.module('app', ['angular-file-input']);
And you're done :)
Create a file input and add the ng-model attribute to it
<input type="file" ng-model="file">
"file" will be the selected File object.
You can also use the multiple
attribute
<input type="file" ng-model="files" multiple>
In this case, files will be an (native) array of Files.
- Clone/fork repository
- npm install
- Make your changes in /lib
- gulp
- A regular version and a minified version will be in dist
- PR your changes :)