I need to create a progress bar to download files. I know that my progress event listener is working. Is there a more βangular wayβ for this? How to update progress bar inside my event listener?
As a preface, please feel free to correct and criticize the overall logical flow if it also needs help.
I have this canvas ...
<canvas id="progress"></canvas>
I have an angularjs directive that uploads files. I added a listener to the progress events (only showing the relevant parts) ...
link: function postLink(scope, element, attrs, ctrl) { var fileUpload = function (img, file) { var xhr = new XMLHttpRequest(); xhr.upload.addEventListener("progress", function(e) { if (e.lengthComputable) { var percentage = Math.round((e.loaded * 100) / e.total);
source share