From 9070125f7d6635a76fed569b21bcd2b14d90f7bd Mon Sep 17 00:00:00 2001
From: Adrian Faciu
Date: Fri, 15 Jul 2016 01:39:19 +0300
Subject: [PATCH] feat(tooltip): tooltip html content (#724)
* Implemented html content for tooltip
---
components/tooltip/tooltip-container.component.ts | 8 +++++++-
components/tooltip/tooltip-options.class.ts | 2 ++
components/tooltip/tooltip.directive.ts | 6 +++++-
demo/components/tooltip/tooltip-demo.html | 2 +-
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/components/tooltip/tooltip-container.component.ts b/components/tooltip/tooltip-container.component.ts
index d09dae9a6b..c3880691b4 100644
--- a/components/tooltip/tooltip-container.component.ts
+++ b/components/tooltip/tooltip-container.component.ts
@@ -13,7 +13,12 @@ import {TooltipOptions} from './tooltip-options.class';
[ngStyle]="{top: top, left: left, display: display}"
[ngClass]="classMap">
- `
@@ -25,6 +30,7 @@ export class TooltipContainerComponent implements AfterViewInit {
private left:string = '-1000px';
private display:string = 'block';
private content:string;
+ private htmlContent:string;
private placement:string;
private popupClass:string;
private animation:boolean;
diff --git a/components/tooltip/tooltip-options.class.ts b/components/tooltip/tooltip-options.class.ts
index cc6dc5e346..25842fa71b 100644
--- a/components/tooltip/tooltip-options.class.ts
+++ b/components/tooltip/tooltip-options.class.ts
@@ -6,6 +6,8 @@ export class TooltipOptions {
public popupClass:string;
public animation:boolean;
public isOpen:boolean;
+ public content:string;
+ public htmlContent:string;
public constructor(options:Object) {
Object.assign(this, options);
diff --git a/components/tooltip/tooltip.directive.ts b/components/tooltip/tooltip.directive.ts
index 0397089141..92c8ba6dc2 100644
--- a/components/tooltip/tooltip.directive.ts
+++ b/components/tooltip/tooltip.directive.ts
@@ -5,10 +5,13 @@ import {
import {TooltipOptions} from './tooltip-options.class';
import {TooltipContainerComponent} from './tooltip-container.component';
-@Directive({selector: '[tooltip]'})
+/* tslint:disable */
+@Directive({selector: '[tooltip], [tooltipHtml]'})
+/* tslint:enable */
export class TooltipDirective {
/* tslint:disable */
@Input('tooltip') public content:string;
+ @Input('tooltipHtml') public htmlContent:string;
@Input('tooltipPlacement') public placement:string = 'top';
@Input('tooltipIsOpen') public isOpen:boolean;
@Input('tooltipEnable') public enable:boolean = true;
@@ -38,6 +41,7 @@ export class TooltipDirective {
this.visible = true;
let options = new TooltipOptions({
content: this.content,
+ htmlContent: this.htmlContent,
placement: this.placement,
animation: this.animation,
hostEl: this.viewContainerRef.element
diff --git a/demo/components/tooltip/tooltip-demo.html b/demo/components/tooltip/tooltip-demo.html
index 6c9fbdf7fb..2ad6114a0d 100644
--- a/demo/components/tooltip/tooltip-demo.html
+++ b/demo/components/tooltip/tooltip-demo.html
@@ -23,7 +23,7 @@
- I can even contain HTML. Check me out!
+ I can even contain HTML. Check me out!