首页 > 解决方案 > Angular 1.4:进度条无法正常工作

问题描述

所以我有一个主应用程序,我们从中选择一些数据,然后将数据传递到处理microservice数据RabbitMQ的地方。现在我Pusher用来发回处理的项目数量。它工作正常,但是当我将该数据传递给 时progress bar,它无法正常工作,例如在计数为 40 之后停止显示条形图。这是我的操作方式:

var channel = pusher.subscribe('my-channel');
channel.bind('my-event', function (data) {
    if (data.message === 'Added') {
          $scope.totalProcessed++;
          $scope.processedPercentage = ($scope.totalProcessed / $scope.totalTOsSelectedForCo2Calculations * 100).toFixed(2);
          $scope.showPercentage = $scope.totalProcessed === $scope.totalTOsSelectedForCo2Calculations ? false : true;
     }
});

这是我的进度条html:

<div class="progress">
        <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"
             aria-valuenow="{{processedPercentage}}" aria-valuemin="0" aria-valuemax="100" style="width: {{ processedPercentage}}%">
            {{processedPercentage}}
        </div>
    </div>

这是当变量$scope.totalTOsSelectedForCo2Calculations值为 203 时它在 14.78% 处停止的图像。我在这里做错了什么?我怎样才能让它工作? 在此处输入图像描述

标签: htmlangularjsprogress-bar

解决方案


推荐阅读