I'm new to AngularJS and I'm attempting to dynamically update the width of a progress bar based on changes in my controller.
Here is what I currently have:
<span id="percentage">$ {{getTotal()}} ({{getPercentage()}}%)</span>
<div class="progress-bar progress-bar-warning"
role="progressbar" aria-valuenow="10" aria-valuemin="0"
aria-valuemax="100" style="width: 10%">
<span class="sr-only">10% Complete (warning)</span>
</div>
In my controller, I have the following:
$scope.total = 254.78;
$scope.threshold = 15000;
$scope.getPercentage = function () {
return (($scope.total * 100) / $scope.threshold).toFixed(2);
}
$scope.getTotal = function () {
return $scope.total;
}
How can I update the value of the progress bar's width property?
Thank you, Alberto.