如何在ngx-countdown-timer中动态更改值

时间:2018-09-25 13:26:29

标签: angular angular5 angular6 angular4-forms

我正在使用ngx-countdown-timer,但动态地我无法传递值,请帮助我做到这一点。
有没有其他解决方案呢?

HTML

<div class="swiper-slide desk" *ngFor="let i of dummy">
  <h1 style="margin-left: 17%; color:#df3b3b">
       <countdown-timer [end]="i.date"  class="dealbox"></countdown-timer>
  </h1>
</div>

1 个答案:

答案 0 :(得分:0)

您可以检查我的代码,它正在工作。 组件类伪数组;

     public dummy=[
        {
            'id':1,
            'date':'2019-06-01 00:00:00'
        },
        {
            'id':2,
            'date':'2019-07-01 00:00:00'
        }
      ];

组件html:

    <div class="swiper-slide desk" *ngFor="let i of dummy">
        <h1 style="margin-left: 17%; color:#df3b3b">
            <countdown-timer [end]="i.date"  class="dealbox"></countdown-timer>
        </h1>
    </div>