Somebody have more documentation for "googleCheckContentLoaded=true" and "loaded" otput?? What I want is to show progress while loading pdf file. I'm using ngx-doc-viewer
Show progress while loading pdf file ngx-doc-viewer
4.7k views Asked by Yul At
4
There are 4 answers
0
On
It worked for me:
view.component.html
<div id="progressBar"><mat-progress-bar mode="indeterminate"></mat-progress-bar></div>
<ngx-doc-viewer [url]="data.file" viewer="google" style="width:100%;height:64vh;"></ngx-doc-viewer>
view.component.ts
isDocLoaded(){
this.timeIntervalFrame = setInterval(() => {
var el = document.getElementById('iframe');
if(el){
clearInterval(this.timeIntervalFrame);
el.addEventListener('load', function(){
console.log("Load event: Iframe doc loaded.");
document.getElementById("progressBar").style.display = "none";
el.addEventListener('load', function(){ console.log("Load event: Iframe doc loaded."); }, true);
}, false);
}
}, (1000));
}
0
On
Easy working and proper solution as per Google Devs
<div id="progressBar"><mat-progress-bar mode="indeterminate"></mat-rogress-bar></div>
<ngx-doc-viewer
[url]="attachment.file_path"
viewer="google"
googleCheckContentLoaded="true"
googleCheckInterval = 3000
googleMaxChecks = 5
(loaded)="contentLoaded()"
class="doc-viewer">
</ngx-doc-viewer>
In scss:
.doc-viewer{
width:100%;
height:80vh;
}
In Ts file:
contentLoaded() {
document.getElementById("progressBar").style.display = "none";
}
Use Iframe with load() output function as given below -