tooltip.directive.ts 934 B

1234567891011121314151617181920212223242526272829303132333435
  1. import {
  2. Directive,
  3. ViewContainerRef,
  4. ComponentFactoryResolver,
  5. Renderer2,
  6. ElementRef,
  7. } from '@angular/core';
  8. // import { TooltipComponent } from 'src/app/shared-components/tooltip/tooltip/tooltip.component';
  9. @Directive({
  10. selector: '[tooltip]',
  11. standalone: true,
  12. })
  13. export class TooltipDirective {
  14. constructor(
  15. private viewContainerRef: ViewContainerRef,
  16. private componentFactoryResolver: ComponentFactoryResolver,
  17. private renderer: Renderer2,
  18. private el: ElementRef,
  19. ) {
  20. // this.showTooltip();
  21. }
  22. // showTooltip() {
  23. // const factory =
  24. // this.componentFactoryResolver.resolveComponentFactory(TooltipComponent);
  25. // const componentRef = this.viewContainerRef.createComponent(factory);
  26. // componentRef.instance.content = 'This is a tooltip';
  27. // this.renderer.appendChild(
  28. // this.el.nativeElement,
  29. // componentRef.location.nativeElement,
  30. // );
  31. // }
  32. }