Andrew Geissler | ba5e3f3 | 2018-05-24 10:58:00 -0700 | [diff] [blame^] | 1 | window.angular && (function(angular) { |
| 2 | 'use strict'; |
Iftekharul Islam | c016139 | 2017-06-14 15:46:15 -0500 | [diff] [blame] | 3 | |
Andrew Geissler | ba5e3f3 | 2018-05-24 10:58:00 -0700 | [diff] [blame^] | 4 | angular |
| 5 | .module('app.common.directives') |
| 6 | .directive('file', function() { |
| 7 | return { |
| 8 | scope: { |
| 9 | file: '=' |
| 10 | }, |
| 11 | link: function(scope, el, attrs) { |
| 12 | el.bind('change', function(event) { |
| 13 | var file = event.target.files[0]; |
| 14 | scope.file = file ? file : undefined; |
| 15 | scope.$apply(); |
| 16 | }); |
| 17 | } |
| 18 | }; |
| 19 | }); |
Iftekharul Islam | c016139 | 2017-06-14 15:46:15 -0500 | [diff] [blame] | 20 | |
Andrew Geissler | ba5e3f3 | 2018-05-24 10:58:00 -0700 | [diff] [blame^] | 21 | })(window.angular); |