Hello i want to create a simple script to run a countdown who start at 05:00 and finish at 00:00. I need help please. I can not find a script that works. Ive tested with function new Date() but i get a format like this Days/Hours/Minutes/Seconds and me i need only Minutes/Seconds. When the countdown is finished an alert appears with a message and the countdown is stopped at 00:00.
For the moment I've this:
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.carname = "Volvo";
$scope.timer = timer();
function timer() {
var minutes = "03";
var secondes = "00";
var init = minutes + ":" + secondes;
var res = document.getElementById("timer").innerHTML = init;
return res;
}
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<h1>{{carname}}</h1>
<h4 id="timer">{{timer()}}</h4>
</div>