Skip to content

Commit

Permalink
feat(tooltip): tooltip html content (#724)
Browse files Browse the repository at this point in the history
* Implemented html content for tooltip
  • Loading branch information
Adrian Faciu authored and valorkin committed Jul 14, 2016
1 parent b2e009b commit 9070125
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion components/tooltip/tooltip-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import {TooltipOptions} from './tooltip-options.class';
[ngStyle]="{top: top, left: left, display: display}"
[ngClass]="classMap">
<div class="tooltip-arrow"></div>
<div class="tooltip-inner">
<div class="tooltip-inner"
*ngIf="htmlContent"
innerHtml="{{htmlContent}}">
</div>
<div class="tooltip-inner"
*ngIf="content">
{{content}}
</div>
</div>`
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions components/tooltip/tooltip-options.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion components/tooltip/tooltip.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion demo/components/tooltip/tooltip-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</p>

<p>
I can even contain HTML. <a href="#" tooltipHtml="htmlTooltip">Check me out!</a>
I can even contain HTML. <a href="#" [tooltipHtml]="htmlTooltip">Check me out!</a>
</p>

<p>
Expand Down

0 comments on commit 9070125

Please sign in to comment.