Commit acc03531dfb8eafa64d89043c20320a552367f3a
1 parent
ce8f52a122
Exists in
master
fixes
Showing
1 changed file
with
16 additions
and
0 deletions
Show diff stats
app/js/app.js
... | ... | @@ -26,6 +26,22 @@ |
26 | 26 | } |
27 | 27 | } |
28 | 28 | }]) |
29 | + | |
30 | + .directive('fileModel', ['$parse', function ($parse) { | |
31 | + return { | |
32 | + restrict: 'A', | |
33 | + link: function(scope, element, attrs) { | |
34 | + var model = $parse(attrs.fileModel); | |
35 | + var modelSetter = model.assign; | |
36 | + | |
37 | + element.bind('change', function(){ | |
38 | + scope.$apply(function(){ | |
39 | + modelSetter(scope, element[0].files[0]); | |
40 | + }); | |
41 | + }); | |
42 | + } | |
43 | + }; | |
44 | + }]) | |
29 | 45 | |
30 | 46 | .provider('myCSRF',[function(){ |
31 | 47 | var headerName = 'X-CSRFToken'; | ... | ... |