Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.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]);
- });
- });
- }
- };
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement