2013-01-30 07:13:38 +01:00
|
|
|
// watches changes in the file upload control (input[file]) and
|
|
|
|
// puts the files selected in an attribute
|
|
|
|
angular
|
|
|
|
.module('webui.directives.fselect', ['webui.services.deps'])
|
|
|
|
.directive('fselect', ['$parse', function(parse) {
|
|
|
|
return function(scope, elem, attrs) {
|
|
|
|
var setfiles = parse(attrs.fselect || attrs.files).assign;
|
|
|
|
elem.bind('change', function() {
|
|
|
|
setfiles(scope, elem[0].files);
|
2017-05-18 06:04:50 +02:00
|
|
|
}).filestyle({
|
|
|
|
placeholder : 'No file selected',
|
|
|
|
iconName : 'fa fa-folder-open',
|
2013-01-30 07:13:38 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
}]);
|