angular get current time

Solutions on MaxInterview for angular get current time by the best coders in the world

showing results for - "angular get current time"
Camilla
19 May 2018
1import { Component } from '@angular/core';
2@Component({
3    selector: 'my-app',
4    template: `{{ now }}`
5})
6export class AppComponent {
7    public now: Date = new Date();
8
9    constructor() {
10        setInterval(() => {
11          this.now = new Date();
12        }, 1);
13    }
14}