Reputation: 125
I asked a similar question on another thread and i got an answer that worked for firefox but not chrome, because chrome blocks popups.
I tried using a button to open the file but the file is not redered.
<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");
};
Upvotes: 2
Views: 5134
Reputation: 564
Try this:
var url = URL.createObjectURL(new Blob(file, {type: 'application/pdf'}));
window.open(url);
Upvotes: 3