角度事件在Firefox中不起作用

时间:2015-09-16 21:01:33

标签: javascript angularjs firefox

我有一个角度函数,允许将文本文件放入文本区域,并将内容放入文本框中。问题是这在Firefox中不起作用。有什么想法吗?

PLunkr

var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
  $scope.text = "";
})
.directive('plkrFileDropZone', [function () {
        return {
            restrict: 'EA',
            scope: {content:'='},
            link: function (scope, element, attrs) {

        scope.content = "drop a .txt file here";

                var processDragOverOrEnter;

                processDragOverOrEnter = function (event) {
                    if (event !== null) {
                        event.preventDefault();
                    }
                    event.dataTransfer.effectAllowed = 'copy';
                    return false;
                };

                element.bind('dragover', processDragOverOrEnter);
                element.bind('dragenter', processDragOverOrEnter);
                element.bind('drop', handleDropEvent);

        function insertText(loadedFile) {

                scope.content = loadedFile.target.result;
          scope.$apply();
        }

                function handleDropEvent(event) {

                    if (event !== null) {
                        event.preventDefault();
                    }
                    var reader = new FileReader();
                    reader.onload = insertText;
                    reader.readAsText(event.dataTransfer.files[0]);

                }
            }
        };
    }]);

1 个答案:

答案 0 :(得分:4)

有一个更简单的解决方案删除行

func main() {
    arg1,arg2 := pow(3,2,10),pow(3,3,20)
    fmt.Println(arg1, arg2)
}