在safari浏览器中加载文件时,我得到了ReferenceError:Can';找不到变量:文件API

在safari浏览器中加载文件时,我得到了ReferenceError:Can';找不到变量:文件API,safari,Safari,我在safari浏览器中加载文件时使用了ngImageCrop,我得到了引用错误:找不到变量:file API。但在其他浏览器中,我的图像加载成功。有人能给我解决方案吗?谢谢 controller.js var handleFileSelect = function(evt) { var file = evt.currentTarget.files[0]; $rootScope.$root.files = file; var reader = new FileReader();

我在safari浏览器中加载文件时使用了ngImageCrop,我得到了引用错误:找不到变量:file API。但在其他浏览器中,我的图像加载成功。有人能给我解决方案吗?谢谢

controller.js

var handleFileSelect = function(evt) {

  var file = evt.currentTarget.files[0];
  $rootScope.$root.files = file;
  var reader = new FileReader();
  reader.onload = function(evt) {
    $scope.$apply(function($scope) {
      $scope.myImage = evt.target.result;
    });
  };
  reader.readAsDataURL(file);
};
angular.element(document.querySelector('#fileInput')).on('change', handleFileSelect);
index.html

        <div>Select an image file: <input type="file" id="fileInput" /></div>
            <div class="cropArea" >
              <img-crop image="myImage" area-type="rectangle"
                    area-init-size="{ w:cropper.cropWidth,h:cropper.cropHeight}" 
                    area-init-coords="{ x:cropper.areaCoords.x,y:cropper.areaCoords.y}" 
                    area-init-is-relative-to-image="true"
                    aspect-ratio="2.1"
                    result-image-size="{w:1400,h:660}"  cropject="cropper"
                    result-image="myCroppedImage"
                    change-on-fly="true"></img-crop>
            </div>
                <div>Result Image:</div>
                <div><img ng-src="{{myCroppedImage}}"  style="width:250px;"/></div>
        </div>
选择一个图像文件:
< /代码>您没有考虑或类似吗?文件API似乎不支持在Safari之前的版本10。你没有考虑或类似?Safari版本10之前的版本似乎不支持文件API。