Angular2 clock update every second
You just need to use arrowfunction
instead of using a traditional function callback
syntax as shown below,
setInterval(() => { //replaced function() by ()=>
this.myDate = new Date();
console.log(this.myDate); // just testing if it is working
}, 1000);