|
@@ -39,4 +39,30 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
|
39
|
39
|
$rootScope.$on('$stateChangeError', function (e, curr, prev) {
|
40
|
40
|
//$state.go('login');
|
41
|
41
|
});
|
42
|
|
- }]);
|
|
42
|
+ }])
|
|
43
|
+ .directive("dropzone", function() {
|
|
44
|
+ return {
|
|
45
|
+ restrict : "A",
|
|
46
|
+ link: function (scope, elem) {
|
|
47
|
+ elem.bind('drop', function(evt) {
|
|
48
|
+ evt.stopPropagation();
|
|
49
|
+ evt.preventDefault();
|
|
50
|
+
|
|
51
|
+ var files = evt.dataTransfer.files;
|
|
52
|
+ for (var i = 0, f; f = files[i]; i++) {
|
|
53
|
+ var reader = new FileReader();
|
|
54
|
+ reader.readAsText(f);
|
|
55
|
+
|
|
56
|
+ reader.onload = (function(file) {
|
|
57
|
+ return function(e) {
|
|
58
|
+ scope.$apply(function() {
|
|
59
|
+
|
|
60
|
+ scope.setDraggedContent(e.target.result, file);
|
|
61
|
+ });
|
|
62
|
+ };
|
|
63
|
+ })(f);
|
|
64
|
+ }
|
|
65
|
+ });
|
|
66
|
+ }
|
|
67
|
+ }
|
|
68
|
+ });
|