Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ghostbar/angular-file-model
Angular.js directive that allows input element's of type file to be handled in models inside a controller's scope
https://github.com/ghostbar/angular-file-model
Last synced: 8 days ago
JSON representation
Angular.js directive that allows input element's of type file to be handled in models inside a controller's scope
- Host: GitHub
- URL: https://github.com/ghostbar/angular-file-model
- Owner: ghostbar
- License: mit
- Created: 2014-01-27T16:25:57.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-01-10T08:36:40.000Z (almost 7 years ago)
- Last Synced: 2024-03-23T12:11:26.241Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 72
- Watchers: 7
- Forks: 17
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
angular-file-model [![Code Climate](https://codeclimate.com/github/ghostbar/angular-file-model/badges/gpa.svg)](https://codeclimate.com/github/ghostbar/angular-file-model)
==================Simple Angular.js directive that allows input element's of type `file` to be
handled in models inside a controller's scope.Usage
-----Install with bower:
bower install angular-file-model --save
Add to your HTML files:
Now, inject to your application:
angular.module('myApp', ['file-model']);
Ready to use in your controllers!:
`file.html`:
Upload`controller.js:`
var DemoCtrl = [
'$scope',
function ($scope) {
$scope.upload = function () {
$scope.fileModel // This is where the file is linked to.
};
}
]Need an actual demo?
--------------------Go and check this out .
Known Issues
------------+ **Using a the modal controller from angular-ui I can't update the variable assigned to file-model**: This is not an issue directly with `angular-file-model`. It's created because the modal controller uses transclusion. Actually, you can't update any other values directly. My workaround for this has been passing an empty object to the controller's scope and putting the file-model (just like other data from fields from the modal) into that object, so what I pass to `file-model` is something like: 'data.file' instead and it works. (`data` being already initialized as `{}` at least in the controller)
Author
------
© 2014, Jose Luis Rivas ``.License
-------
The files are licensed under the MIT terms.