Angular 4 display current time

前端 未结 6 1614
青春惊慌失措
青春惊慌失措 2021-02-02 11:44

What is the correct (canonical) way to display current time in angular 4 change detection system?

The problem is as follows: current time changes constantly, each mome

6条回答
  •  无人共我
    2021-02-02 12:23

    Use arrow function.

    constructor(cd: ChangeDetectorRef){
        setInterval(() => { cd.detectChanges();  }, 1);
      }
    

提交回复
热议问题