Refactors most controllers and directives into classes for more organized and maintainable code
This commit is contained in:
16
app/assets/javascripts/directives/functional/file-change.js
Normal file
16
app/assets/javascripts/directives/functional/file-change.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/* @ngInject */
|
||||
export function fileChange() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
handler: '&'
|
||||
},
|
||||
link: function(scope, element) {
|
||||
element.on('change', function(event) {
|
||||
scope.$apply(function() {
|
||||
scope.handler({ files: event.target.files });
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user