jrquick17 / ionic4-tooltips

Tooltips module for AngularJS/Angular2+ and Ionic 2+.
https://ionic4-tooltips.jrquick.com
MIT License
12 stars 9 forks source link

Tooltip not shown in ion-item #17

Open mediengestadler opened 3 years ago

mediengestadler commented 3 years ago

Hi,

if you use tooltip laptop in an ion-item it will be not displayed, because the wrapper is overflow: hidden and the tip is inserted after the element.

It would be better, if the tooltip is inserted at the end of the page

Baidaly commented 9 months ago

I just copied the code into my project and adjusted the following to insert the component at the end of the page:

export class TooltipDirective implements OnInit, AfterViewInit, OnDestroy {
    // The rest of the code
    constructor(
        private el: ElementRef,
        private appRef: ApplicationRef,
        private platform: Platform,
        private cfr: ComponentFactoryResolver,
        private tooltipCtrl: TooltipController,
        private injector: Injector,
        @Inject(DOCUMENT) private document: Document
    ) {}

    private _createTooltipComponent() {
        const componentFactory = this.cfr.resolveComponentFactory(TooltipBox);
        this._tooltipElement = componentFactory.create(this.injector);

        // Append the tooltip component to the body of the page
        this.document.body.appendChild(
            this._tooltipElement.location.nativeElement
        );

        this.appRef.attachView(this._tooltipElement.hostView);
        this.tooltipCtrl.addTooltip(this);
    }

    // The rest of the code
}

Here is the sample structure: F2429599-B3AC-4B7E-84D7-E94632A38A49_1_201_a