I am looking to create a progress bar using the uikit framework. The documentation states that it can be done like this:
<div class="uk-progress">
<div class="uk-progress-bar" style="width: 40%;">40%</div>
</div>
However, this method is static. To make it dynamic, I have written a function in Angular that calculates the percentage:
getPercentage: function() {
var self = this;
var done = this.downloadStatus.done.replace(/,/g, "");
var total = this.downloadStatus.total.replace(/,/g, "");
self.percentage = 0;
if (parseInt(total) != 0) {
self.percentage = (parseInt(done) / parseInt(total)) * 100;
}
return self.percentage;
}
The width of the progress bar is determined by the "style" attribute in the HTML. Is it possible to make this width dynamic using ng-style in Angular? I attempted the following:
<div class="uk-progress">
<div class="uk-progress-bar" ng-style="{{getPercentage()}}">40%</div>
</div>
However, this approach was unsuccessful. Any help would be appreciated. Thank you.