我在另一个线程上问了类似的问题,但我得到的答案适用于Firefox,但不适用于chrome,因为chrome会阻止弹出窗口。
我尝试使用按钮打开文件,但该文件未重做。
<div class="uploadButtonSection">
<input type="image" src="clip.png" ngf-select="uploadFiles($files)" multiple
accept="application/pdf" ngf-max-height="1000" ngf-max-size="5MB" class="uploadIcon"/>
<ul class="uploadList">
<li ng-repeat="file in files" style="font:smaller">
<div class="attachmentIcon">
<img src="pdf-icon.png" ng-click="openFile(file)">
<div class="customBtn" ng-click="removeFile(file)">Remove</div>
{{file.name}}
</div>
</li>
</ul>
$scope.openFiles = function(file){
var url = URL.createObjectURL(file);
window.open(url,"_blank");
};
答案 0 :(得分:0)
尝试一下:
var url = URL.createObjectURL(new Blob(file, {type: 'application/pdf'}));
window.open(url);