Skip to content

[Question] Synchronising two timers when one behind *ngIf statement #116

Description

@majkers

Is there a way to synchronize two timers when one is displayed always and only hidden by css styles on MD and SM screens and the other is displayed on MD and SM screens but on an panel that is behind *ngIf condition that becomes true on click?

More or less like that:

<countdown #first [config]="sessionTimerConfig" class="visibleOnLargeScreensOnly">

<button (click)="show = !show" class="visibleOnMediumAndSmallScreensOnly">
<div *ngIf="show" class="visibleOnMediumAndSmallScreensOnly">
  <countdown #second [config]="{leftTime: first.left/1000}" class="visibleOnLargeScreensOnly">
</div>

Currently I do it like that (to tell the truth first is a ViewChild property of component):
[config]="{leftTime: first.left/1000}"
but sometimes they are out of syns for 500ms more or less... Do you know any better way to do that?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions