xref: /openbmc/phosphor-webui/app/common/directives/file.js (revision c016139f87e9ad6a7f95affba3d4f75f624aafe0)
1window.angular && (function (angular) {
2    'use strict';
3
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        });
20
21})(window.angular);