|
@@ -4,6 +4,20 @@ angular.module('app')
|
4
|
4
|
|
5
|
5
|
$scope.image = null;
|
6
|
6
|
|
|
7
|
+ $scope.input = angular.element(angular.element("#filePicker")[0]);
|
|
8
|
+ $scope.input.on("change", function (e) {
|
|
9
|
+ var reader = new FileReader();
|
|
10
|
+ var f = e.target.files[0];
|
|
11
|
+ reader.readAsBinaryString(f);
|
|
12
|
+ reader.onload = (function(file) {
|
|
13
|
+ return function(e) {
|
|
14
|
+ $scope.$apply(function() {
|
|
15
|
+ $scope.fileDropped(e.target.result, file);
|
|
16
|
+ });
|
|
17
|
+ };
|
|
18
|
+ })(f);
|
|
19
|
+ });
|
|
20
|
+
|
7
|
21
|
$scope.fileDropped = function(content, file)
|
8
|
22
|
{
|
9
|
23
|
$scope.image = {
|
|
@@ -11,4 +25,9 @@ angular.module('app')
|
11
|
25
|
name: file.name
|
12
|
26
|
};
|
13
|
27
|
};
|
|
28
|
+
|
|
29
|
+ $scope.pickFile = function()
|
|
30
|
+ {
|
|
31
|
+ $scope.input.click();
|
|
32
|
+ };
|
14
|
33
|
}]);
|