Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

For progressbar I have converted string to bytes and then i have method that convert total bytes to KB or MB based on total bytes, Everytime message comes in i calculate bytes and push into new array currentFileBytes and then have sum of this array that will be current value of the array $scope.dynamic. problem is even data value is less then $scope.max it prints the console so i think i am not calculating $scope.max correctly,so I have two questions here.

1- How can set $scope.max in bytes as i have tried 3MB in below code, but problem here is progressbar max count is up to 100 ?

2- How to set current value to $scope.dynamic so progressbar can show progress everytime message comes in ?

main.html

  <div class="col-md-8">
            <uib-progressbar max="max" animate="true" value="dynamic"><p>File recording in progress</p></uib-progressbar>
        </div>

ctrl.js

$scope.event = ['lorem ipsum fdsmfds,mfbs', 'lorem ipsum', 'lorem ipsum', 'lorem ipsum', 'lorem ipsum', 'lorem ipsum'];

   $scope.max = 1000 * 1000 * 3 + ' ' + 'MB';
   var currentFileBytes = [];
   var currentBytesSum;
   function formatBytes(bytes, decimals) {
       /* logic here to convert total bytes to KB or MB and assign it to data variable */
       console.log('data in current message', data);
       $scope.dynamic = data
       if (data > $scope.max) {
           // execute download and delete file here if max file size is same
           console.log('bytes are same');
       }
   }
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.