Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(legend): Fixes issue whether the legend item does not work with t…
Browse files Browse the repository at this point in the history
…he new ivy engine.

fixes #26
  • Loading branch information
thomaspink committed Feb 4, 2020
1 parent 5f6409d commit 24ffc75
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions components/legend/src/legend-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ export class DtLegendOverlay {}
export class DtLegendItem extends DtOverlayTrigger<{}>
implements AfterContentInit, OnDestroy {
/** @internal The template ref that will be rendered as an overlay. */
@Input()
@Input() _overlayTemplateRef?: TemplateRef<{}>;

@ContentChild(DtLegendOverlay, { read: TemplateRef, static: true })
_overlayTemplateRef?: TemplateRef<{}>;
_contentOverlayTemplateRef?: TemplateRef<{}>;

/** Whether the item has an overlay to show when hovering. */
get hasOverlay(): boolean {
return !!this._overlayTemplateRef;
return Boolean(this._overlayTemplateRef || this._contentOverlayTemplateRef);
}

constructor(
Expand All @@ -89,8 +90,10 @@ export class DtLegendItem extends DtOverlayTrigger<{}>
}

ngAfterContentInit(): void {
if (this._overlayTemplateRef) {
this.overlay = this._overlayTemplateRef;
const overlayTemplate =
this._overlayTemplateRef || this._contentOverlayTemplateRef;
if (overlayTemplate) {
this.overlay = overlayTemplate;
}
}

Expand Down

0 comments on commit 24ffc75

Please sign in to comment.