From acc03531dfb8eafa64d89043c20320a552367f3a Mon Sep 17 00:00:00 2001 From: anchit Date: Fri, 16 Jun 2017 16:12:03 +0530 Subject: [PATCH] fixes --- app/js/app.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/js/app.js b/app/js/app.js index e167e2b..8d04206 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -26,6 +26,22 @@ } } }]) + + .directive('fileModel', ['$parse', function ($parse) { + return { + restrict: 'A', + link: function(scope, element, attrs) { + var model = $parse(attrs.fileModel); + var modelSetter = model.assign; + + element.bind('change', function(){ + scope.$apply(function(){ + modelSetter(scope, element[0].files[0]); + }); + }); + } + }; + }]) .provider('myCSRF',[function(){ var headerName = 'X-CSRFToken'; -- 2.0.0