Created
February 6, 2025 15:18
-
-
Save Julianhm9612/eb1adc793ae0b92928a86dac3ccf6f91 to your computer and use it in GitHub Desktop.
Timer in minutes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.counter = angular.copy($scope.datos.tiempoExpiracion * 60000); | |
function countdown() { | |
$scope.onTimeout = function () { | |
if ($scope.counter > 0) { | |
$scope.counter -= 1000; | |
const minutes = Math.floor(($scope.counter / 1000 / 60) % 60); | |
const seconds = Math.floor(($scope.counter / 1000) % 60); | |
vm.timeLeft = ('0' + minutes).slice(-2) + ':' + ('0' + seconds).slice(-2); | |
vm.mytimeout = $timeout($scope.onTimeout, 1000); | |
} else { | |
cvvQueryParent.showMessage('timeout'); | |
} | |
}; | |
vm.mytimeout = $timeout($scope.onTimeout, 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment