I Have one Date variable, and I am updating it every second to make it live.
Now here is my variable.
var stationdate = new Date(data.localTime);
My Javascript code to update it per second.
window.setInterval(function () {
stationdate = new Date(stationdate.setSeconds(stationdate.getSeconds() + 1));
}, 1000);
And My Type Script code to return it to Angular UI.
window.setInterval(() => this.time = stationdate, 1000);
My Issue.
It works perfectly if both functions are seprate.
but it stops working if I combine them.
see below.
window.setInterval(function () {
stationdate = new Date(stationdate.setSeconds(stationdate.getSeconds() + 1));
this.time = stationdate;
}, 1000);
AM I MISSING SOMETHING WITH FAT ARROW OF TYPE SCRIPT?
What should be the proper function?