Skip to content

Commit 3aff875

Browse files
committed
chore(Tooltip, TooltipDefinition): renaming data into templateContext and exposing as $implicit in the templateOutlet
1 parent b42b865 commit 3aff875

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/tooltip/definition-tooptip.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { PopoverContainer } from "carbon-components-angular/popover";
4141
role="tooltip">
4242
<span class="cds--popover-content cds--definition-tooltip">
4343
<ng-container *ngIf="!isTemplate(description)">{{description}}</ng-container>
44-
<ng-template *ngIf="isTemplate(description)" [ngTemplateOutlet]="description" [ngTemplateOutletContext]="{ data }"></ng-template>
44+
<ng-template *ngIf="isTemplate(description)" [ngTemplateOutlet]="description" [ngTemplateOutletContext]="{ $implicit: templateContext }"></ng-template>
4545
<span *ngIf="autoAlign" class="cds--popover-caret cds--popover--auto-align"></span>
4646
</span>
4747
<span *ngIf="!autoAlign" class="cds--popover-caret"></span>
@@ -58,9 +58,9 @@ export class TooltipDefinition extends PopoverContainer {
5858
*/
5959
@Input() description: string | TemplateRef<any>;
6060
/**
61-
* Optional data for templates
61+
* Optional data for templates passed as implicit context
6262
*/
63-
@Input() data = {}
63+
@Input() templateContext: any;
6464

6565
constructor(
6666
protected elementRef: ElementRef,

src/tooltip/tooltip.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { PopoverContainer } from "carbon-components-angular/popover";
3939
<ng-container *ngIf="!disabled">
4040
<span class="cds--popover-content cds--tooltip-content">
4141
<ng-container *ngIf="!isTemplate(description)">{{description}}</ng-container>
42-
<ng-template *ngIf="isTemplate(description)" [ngTemplateOutlet]="description" [ngTemplateOutletContext]="{ data }"></ng-template>
42+
<ng-template *ngIf="isTemplate(description)" [ngTemplateOutlet]="description" [ngTemplateOutletContext]="{ $implicit: templateContext }"></ng-template>
4343
<span *ngIf="autoAlign" class="cds--popover-caret cds--popover--auto-align"></span>
4444
</span>
4545
<span *ngIf="!autoAlign" class="cds--popover-caret"></span>
@@ -70,9 +70,9 @@ export class Tooltip extends PopoverContainer implements AfterContentChecked {
7070
*/
7171
@Input() description: string | TemplateRef<any>;
7272
/**
73-
* Optional data for templates
73+
* Optional data for templates passed as implicit context
7474
*/
75-
@Input() data = {}
75+
@Input() templateContext: any
7676

7777
@ViewChild("contentWrapper") wrapper: ElementRef<HTMLSpanElement>;
7878

0 commit comments

Comments
 (0)