Skip to content

Commit

Permalink
Fixed #1506
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Dec 9, 2016
1 parent 3ab1473 commit 26b1caf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions components/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class Tooltip implements OnDestroy {
@Input() tooltipEvent: string = 'hover';

@Input() appendTo: any = 'body';

@Input() positionStyle: string;

container: any;

Expand Down Expand Up @@ -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() {
Expand All @@ -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')
Expand All @@ -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;
}
Expand Down

0 comments on commit 26b1caf

Please sign in to comment.