Skip to content

Commit

Permalink
fix(module:tooltip): fix properties updated before origin is set (#4229)
Browse files Browse the repository at this point in the history
close #4250
  • Loading branch information
Wendell authored and vthinkxie committed Oct 14, 2019
1 parent a7ecb8b commit b2b9c13
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/tooltip/base/nz-tooltip-base.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export abstract class NzTooltipBaseDirective implements OnChanges, OnInit, OnDes
`'<nz-tooltip></nz-tooltip>', '<nz-popover></nz-popover>' and '<nz-popconfirm></nz-popconfirm>' is deprecated and will be removed in 9.0.0. Refer: https://ng.ant.design/components/tooltip/zh .`
);
this.tooltip = this._tooltip;
this.tooltip.setOverlayOrigin(this as CdkOverlayOrigin);
}

this.tooltip.nzVisibleChange
Expand All @@ -180,7 +181,6 @@ export abstract class NzTooltipBaseDirective implements OnChanges, OnInit, OnDes
this.isTooltipComponentVisible = visible;
this.nzVisibleChange.emit(visible);
});
this.tooltip.setOverlayOrigin(this as CdkOverlayOrigin);
}

ngAfterViewInit(): void {
Expand Down Expand Up @@ -223,6 +223,9 @@ export abstract class NzTooltipBaseDirective implements OnChanges, OnInit, OnDes
tooltipRef.location.nativeElement
); // Remove the component's DOM because it should be in the overlay container.

// If the tooltip component is dynamically created, we should set its origin before updating properties to
// the component.
this.tooltip.setOverlayOrigin(this as CdkOverlayOrigin);
// Update all properties to the component.
this.updateChangedProperties(this.needProxyProperties);
}
Expand Down

0 comments on commit b2b9c13

Please sign in to comment.