I have this progress bar
<div class="progress progress-striped" ng-class"{active: file.isUploading()}">
<div class="progress bar" role="progressbar" ng-style="{'width' : (file.sizeUploaded() / file.size * 100) + '%'}"></div>
</div>
After debugging with chrome dev tools, I am sending the good width to ng-style. When I stop the execution (Using F8 in source code), the style update to the good width. If I don't stop the execution, the bar goes slowly to barely 1% then when the upload as reached 100%, the bar goes from 1 to 100%.
I am using ng-flow in order to upload my files in chunks rather then one full file.
Here some images to show the behavior:
First image show it isn't updating the style fast enough (The bar at 0% doesn't show a tiny blue bar)
This is what happens when the file is completely uploaded
When I press F8 in developer tools source code (Debugging) the style is updated correctly.
Here is a link to a working example of an upload with progress bar.
I tried using file.progress() in the ng-style, but it does the same behavior. While out of debugger, the size uploaded change just fine, it's really just the ng-style that doesn't seems to update.
Edit: Testing in Firefox, the bar load slightly faster, up to around 5-10% when the file reach 100%.
Edit 2:
sizeUploaded: function () {
var size = 0;
each(this.files, function (file) {
size += file.sizeUploaded();
});
return size;
}
Here the html...
<div flow-init flow-name="flow" class="span5 clearfix">
<div class="alert" flow-drop>
Drag And Drop your file(s) here
</div>
<span class="btn" flow-btn><i class="icon icon-file"></i> Upload File</span>
<div ng-repeat="file in flow.files">
{{file.name}} ({{file.size}} kB)
<br />
IS COMPLETE: {{file.isComplete()}}
<br />
ERROR: {{file.error}}
<br />
SIZE UPLOADED: {{file.sizeUploaded()}} kB
<br />
IS UPLOADING: {{file.isUploading()}}
<br />
{{file.sizeUploaded()}} kB / {{file.size}} kB | {{file.sizeUploaded() / file.size * 100 | number:0}}%
<div class="progress active progress-striped" ng-class"{active: file.isUploading()}">
<div class="progress bar" role="progressbar" ng-style="{'width' : (file.sizeUploaded() / file.size * 100) + '%'}">{{file.sizeUploaded()}} / {{file.size}} kB | {{file.sizeUploaded() / file.size * 100 | number:0}}%</div>
</div>
<input type="button" ng-click="file.resume()" value="Start/Resume" />
<input type="button" ng-click="file.pause()" value="Pause"/>
</div>
<table>
<tr ng-repeat="file in flow.files">
<td>{{$index+1}} | </td>
<td>{{file.name}}</td>
</tr>
</table>
</div>
Additional note: I am using Angular 1.1.5