Files
cbsnexora/src/app/configuration-wizard/popover/popover-close.directive.ts
T
Ralph HopmanandAdam Saghy cac1d11ad7 build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
2025-01-15 11:59:30 +00:00

31 lines
713 B
TypeScript

/** Angular Imports */
import { Directive, HostListener, Input, Optional } from '@angular/core';
/** Popover Ref */
import { PopoverRef } from './popover-ref';
/**
* Button that will close the current popover.
*/
@Directive({
selector: '[mifosxPopoverClose]'
})
export class PopoverCloseDirective<T = any> {
@Input('mifosxPopoverClose') popoverResult: T;
/**
* @param {PopoverRef<T>} popoverRef PopoverRef<T>.
*/
constructor(@Optional() private popoverRef: PopoverRef<T>) {}
@HostListener('click') onClick(): void {
if (!this.popoverRef) {
console.error('PopoverClose is not supported within a template');
return;
}
this.popoverRef.close(this.popoverResult);
}
}