import { Component, inject } from '@angular/core';
import { CountdownEvent } from 'ngx-countdown';
import { CountDownComponent } from '@yelon/abc/count-down';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'components-count-down-simple',
template: `
<div>
<count-down #cd [target]="10" (event)="handleEvent($event)" style="font-size: 20px;" />
</div>
<button nz-button (click)="cd.instance.pause()">Pause</button>
<button nz-button (click)="cd.instance.resume()">Resume</button>
`,
standalone: true,
imports: [CountDownComponent, NzButtonModule]
})
export class ComponentsCountDownSimpleComponent {
private readonly msg = inject(NzMessageService);
handleEvent(e: CountdownEvent): void {
if (e.action === 'done') {
this.msg.success('finised');
}
}
}