diff --git a/components/popover/nz-popover.component.ts b/components/popover/nz-popover.component.ts index af30211eacc..8f70d585278 100644 --- a/components/popover/nz-popover.component.ts +++ b/components/popover/nz-popover.component.ts @@ -45,8 +45,11 @@ import { NzTooltipBaseComponentLegacy, NzToolTipComponent } from 'ng-zorro-antd/ export class NzPopoverComponent extends NzToolTipComponent { _prefix = 'ant-popover-placement'; - @Input() @ContentChild('neverUsedTemplate', { static: true }) nzPopoverTitle: NzTSType; - @Input() @ContentChild('nzTemplate', { static: true }) nzPopoverContent: NzTSType; + /** + * Use `neverUsedTemplate` to force `nzTemplate` to be catched by `nzPopoverContent`. + */ + @Input() @ContentChild('neverUsedTemplate', { static: true }) nzTitle: NzTSType; + @Input() @ContentChild('nzTemplate', { static: true }) nzContent: NzTSType; constructor(cdr: ChangeDetectorRef, @Host() @Optional() public noAnimation?: NzNoAnimationDirective) { super(cdr, noAnimation); diff --git a/components/tooltip/base/nz-tooltip-base-legacy.component.ts b/components/tooltip/base/nz-tooltip-base-legacy.component.ts index 258c80c8162..1d84abad492 100644 --- a/components/tooltip/base/nz-tooltip-base-legacy.component.ts +++ b/components/tooltip/base/nz-tooltip-base-legacy.component.ts @@ -7,18 +7,7 @@ */ import { CdkConnectedOverlay } from '@angular/cdk/overlay'; -import { - ChangeDetectorRef, - ContentChild, - EventEmitter, - Host, - Input, - OnChanges, - Optional, - Output, - TemplateRef, - ViewChild -} from '@angular/core'; +import { ChangeDetectorRef, EventEmitter, Host, Input, OnChanges, Optional, Output, ViewChild } from '@angular/core'; import { toBoolean, NgStyleInterface, NzNoAnimationDirective, POSITION_MAP } from 'ng-zorro-antd/core'; import { NzTooltipTrigger } from '../nz-tooltip.definitions'; @@ -42,7 +31,6 @@ import { NzTooltipBaseComponent } from './nz-tooltip-base.component'; export class NzTooltipBaseComponentLegacy extends NzTooltipBaseComponent implements OnChanges { @ViewChild('overlay', { static: false }) overlay: CdkConnectedOverlay; - @Input() @ContentChild('nzTemplate', { static: true }) contentTitle: string | TemplateRef | null; @Input() nzOverlayClassName = ''; @Input() nzOverlayStyle: NgStyleInterface = {}; @Input() nzMouseEnterDelay = 0.15; // second diff --git a/components/tooltip/base/nz-tooltip-base.component.ts b/components/tooltip/base/nz-tooltip-base.component.ts index 3ebc7c80f5c..c26a533ce24 100644 --- a/components/tooltip/base/nz-tooltip-base.component.ts +++ b/components/tooltip/base/nz-tooltip-base.component.ts @@ -117,6 +117,6 @@ export abstract class NzTooltipBaseComponent { } private isContentEmpty(): boolean { - return this.nzTitle instanceof TemplateRef ? false : this.nzTitle === '' || !isNotNil(this.nzTitle); + return this.nzContent instanceof TemplateRef ? false : this.nzContent === '' || !isNotNil(this.nzContent); } }