From 26b1cafc7f7b1b68ec2b67f3b149608a0cb11076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fatay=20=C3=87ivici?= Date: Fri, 9 Dec 2016 11:18:46 +0300 Subject: [PATCH] Fixed #1506 --- components/tooltip/tooltip.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/tooltip/tooltip.ts b/components/tooltip/tooltip.ts index 581bc43015f..0f2cfe3aa1e 100644 --- a/components/tooltip/tooltip.ts +++ b/components/tooltip/tooltip.ts @@ -17,6 +17,8 @@ export class Tooltip implements OnDestroy { @Input() tooltipEvent: string = 'hover'; @Input() appendTo: any = 'body'; + + @Input() positionStyle: string; container: any; @@ -94,8 +96,7 @@ export class Tooltip implements OnDestroy { hide() { this.container.style.display = 'none'; - document.body.removeChild(this.container); - this.container = null; + this.ngOnDestroy(); } create() { @@ -110,6 +111,10 @@ export class Tooltip implements OnDestroy { tooltipText.className = 'ui-tooltip-text ui-shadow ui-corner-all'; tooltipText.innerHTML = this.text; + if(this.positionStyle) { + this.container.style.position = this.positionStyle; + } + this.container.appendChild(tooltipText); if(this.appendTo === 'body') @@ -123,7 +128,7 @@ export class Tooltip implements OnDestroy { if(this.appendTo === 'body') document.body.removeChild(this.container); else - this.domHandler.appendChild(this.container, this.appendTo); + this.domHandler.removeChild(this.container, this.appendTo); } this.container = null; }