Skip to content

Commit

Permalink
fix(Tooltip): Add closeOnClick input to pass to Tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
russi-sinha committed Sep 9, 2024
1 parent 5c2bcb2 commit 1650029
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions projects/novo-elements/src/elements/tooltip/Tooltip.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export class TooltipDirective implements OnDestroy, OnInit {
autoPosition: boolean = true;
@Input('tooltipIsHTML')
isHTML: boolean;
@Input('tooltipCloseOnClick')
closeOnClick: boolean;

private tooltipInstance: NovoTooltip | null;
private portal: ComponentPortal<NovoTooltip>;
Expand Down Expand Up @@ -71,6 +73,14 @@ export class TooltipDirective implements OnDestroy, OnInit {
}
}

@HostListener('click')
onclick(): void {
if (this.overlayRef && !this.always && this.closeOnClick) {
this.hide();
this.overlayRef.dispose();
}
}

ngOnInit(): void {
if (this.tooltip && this.always && this.active) {
this.show();
Expand Down

0 comments on commit 1650029

Please sign in to comment.