I want a running clock (Digital) on one of mine Angular 4.3 application.
I tried lots of R&D for that, but didn't get succeed.
also there is no reference of angular ticking clock.
So I tried to Add solution based on java script, but it also not working.
see below code.
startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = this.checkTime(m);
s = this.checkTime(s);
var t = setTimeout(this.startTime, 500);
this.clock = commonSetting.formatedDate(h + ":" + m + ":" + s); // this is the variable that I am showing on the front end.
}
checkTime(i) {
if (i < 10) { i = "0" + i }; // add zero in front of numbers < 10
return i;
}
I don't even know this is good practice or not.
can anyone help me with this?