Files
standardnotes-app-web/app/assets/javascripts/directives/functional/file-change.ts
2020-04-13 08:27:10 -05:00

20 lines
417 B
TypeScript

/* @ngInject */
export function fileChange() {
return {
restrict: 'A',
scope: {
handler: '&'
},
link: function (scope: ng.IScope, element: JQLite) {
element.on('change', (event) => {
scope.$apply(() => {
const files = (event.target as HTMLInputElement).files;
(scope as any).handler({
files: files
});
});
});
}
};
}