Files
pyrofetes-frontend/src/app/components/modal-button/modal-button.ts
2025-12-01 10:48:03 +01:00

43 lines
1009 B
TypeScript

import {Component, input, Input, output} from '@angular/core';
import {NzModalComponent} from "ng-zorro-antd/modal";
import {NzButtonComponent} from "ng-zorro-antd/button";
@Component({
selector: 'app-modal-button',
imports: [
NzModalComponent,
NzButtonComponent,
],
templateUrl: './modal-button.html',
styleUrl: './modal-button.css',
})
export class ModalButton {
size = input<string>();
name = input.required<string>()
type = input<"primary" | "default" | "dashed" | "link" | "text">()
ok = output<void>();
cancel = output<void>();
isVisible = false;
isOkLoading = false;
showModal(): void {
this.isVisible = true;
}
handleOk(): void {
this.isOkLoading = true;
setTimeout(() => {
this.ok.emit();
this.isVisible = false;
this.isOkLoading = false;
}, 1000);
}
handleCancel(): void {
this.cancel.emit();
this.isVisible = false;
}
}