Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip html content #724

Merged
merged 3 commits into from
Jul 14, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 3 additions & 1 deletion components/tooltip/tooltip.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import {
import {TooltipOptions} from './tooltip-options.class';
import {TooltipContainerComponent} from './tooltip-container.component';

@Directive({selector: '[tooltip]'})
@Directive({selector: '[tooltip], [tooltipHtml]'})

This comment was marked as off-topic.

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 +39,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