Your search did not match any results.
Progress Bar

Progress Bar

Documentation

The ProgressBar is a UI component that shows current progress.

Backend API
Copy to CodePen
Apply
Reset
const DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', ($scope) => { let seconds = 10; let inProgress = false; let intervalId; $scope.progressBarValue = 0; $scope.buttonText = 'Start progress'; $scope.progressBarOptions = { min: 0, max: 100, width: '90%', bindingOptions: { value: 'progressBarValue', }, statusFormat(value) { return `Loading: ${value * 100}%`; }, onComplete(e) { inProgress = false; $scope.buttonText = 'Restart progress'; e.element.addClass('complete'); }, }; $scope.buttonOptions = { width: 200, bindingOptions: { text: 'buttonText', }, onClick() { $('#progressBarStatus').removeClass('complete'); if (inProgress) { $scope.buttonText = 'Continue progress'; clearInterval(intervalId); } else { $scope.buttonText = 'Stop progress'; setCurrentStatus(); intervalId = setInterval(timer, 1000); } inProgress = !inProgress; }, }; function setCurrentStatus() { $scope.progressBarValue = (10 - seconds) * 10; $('#timer').text((`0${seconds}`).slice(-2)); } function timer() { seconds -= 1; $scope.$apply(() => { setCurrentStatus(); }); if (seconds === 0) { clearInterval(intervalId); seconds = 10; } } });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.2.3/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.2.3/css/dx.light.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script> <script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C/script%3E'))</script> <script src="https://cdn3.devexpress.com/jslib/21.2.3/js/dx.all.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container" ng-app="DemoApp" ng-controller="DemoController"> <div class="form"> <div id="progress-button" dx-button="buttonOptions"></div> <div class="progress-info"> Time left 00:00:<span id="timer">10</span> </div> <div id="progress"> <div id="progressBarStatus" dx-progress-bar="progressBarOptions"></div> </div> </div> </div> </body> </html>
.form { padding: 20% 0; text-align: center; } #progress-button { margin-bottom: 20px; } #progressBarStatus { display: inline-block; } .complete .dx-progressbar-range { background-color: green; }