Skip to content

Commit 0146110

Browse files
committed
little refactor to make it work
1 parent 8b66ceb commit 0146110

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

angular-file-model.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,25 @@
88
(function () {
99
'use strict';
1010

11-
angular.module('angular-file-model')
12-
.directive('fileModel', [
13-
'$parse',
14-
function ($parse) {
11+
angular.module('angular-file-model', [])
12+
13+
.directive('fileModel', [
14+
'$parse',
15+
function ($parse) {
1516
return {
16-
restrict: 'A',
17-
link: function(scope, element, attrs) {
18-
var model = $parse(attrs.fileModel);
19-
var modelSetter = model.assign;
20-
21-
element.bind('change', function(){
22-
scope.$apply(function(){
23-
modelSetter(scope, element[0].files[0]);
24-
});
25-
});
26-
}
17+
restrict: 'A',
18+
link: function(scope, element, attrs) {
19+
var model = $parse(attrs.fileModel);
20+
var modelSetter = model.assign;
21+
22+
element.bind('change', function(){
23+
scope.$apply(function(){
24+
modelSetter(scope, element[0].files[0]);
25+
});
26+
});
27+
}
2728
};
28-
}]);
29+
}
30+
]);
2931

3032
})();

0 commit comments

Comments
 (0)