import { AfterViewInit, Directive, ElementRef } from '@angular/core';
import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap';

@Directive({
  selector: '[appDetectOverflowTooltip]',
  standalone: false
})
export class DetectOverflowTooltipDirective implements AfterViewInit{

  constructor(private element: ElementRef<HTMLElement>, private tooltip: NgbTooltip) { }

  ngAfterViewInit(): void {
    this.tooltip.disableTooltip = this.element.nativeElement.scrollWidth <= this.element.nativeElement.clientWidth;
  }

}
