33 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44 */
55
6- import { ComponentPortal , Portal , PortalModule , TemplatePortal } from '@angular/cdk/portal' ;
6+ import { ComponentPortal , Portal , PortalModule } from '@angular/cdk/portal' ;
77import {
88 ChangeDetectionStrategy ,
99 ChangeDetectorRef ,
@@ -21,6 +21,7 @@ import {
2121} from '@angular/core' ;
2222
2323import { NzConfigService , onConfigChangeEventForComponent } from 'ng-zorro-antd/core/config' ;
24+ import { NzOutletModule } from 'ng-zorro-antd/core/outlet' ;
2425import { NzSafeAny } from 'ng-zorro-antd/core/types' ;
2526
2627import { NZ_EMPTY_COMPONENT_NAME , NzEmptyCustomContent , NzEmptySize } from './config' ;
@@ -50,8 +51,10 @@ type NzEmptyContentType = 'component' | 'template' | 'string';
5051 exportAs : 'nzEmbedEmpty' ,
5152 template : `
5253 @if (content) {
53- @if (contentType === 'string') {
54- {{ content }}
54+ @if (contentType === 'template' || contentType === 'string') {
55+ <ng-container *nzStringTemplateOutlet="content; context: { $implicit: this.nzComponentName }">{{
56+ content
57+ }}</ng-container>
5558 } @else {
5659 <ng-template [cdkPortalOutlet]="contentPortal" />
5760 }
@@ -71,7 +74,7 @@ type NzEmptyContentType = 'component' | 'template' | 'string';
7174 }
7275 }
7376 ` ,
74- imports : [ NzEmptyComponent , PortalModule ]
77+ imports : [ NzEmptyComponent , PortalModule , NzOutletModule ]
7578} )
7679export class NzEmbedEmptyComponent implements OnChanges , OnInit {
7780 private configService = inject ( NzConfigService ) ;
@@ -116,9 +119,8 @@ export class NzEmbedEmptyComponent implements OnChanges, OnInit {
116119 if ( typeof content === 'string' ) {
117120 this . contentType = 'string' ;
118121 } else if ( content instanceof TemplateRef ) {
119- const context = { $implicit : this . nzComponentName } as NzSafeAny ;
120122 this . contentType = 'template' ;
121- this . contentPortal = new TemplatePortal ( content , this . viewContainerRef , context ) ;
123+ this . contentPortal = undefined ;
122124 } else if ( content instanceof Type ) {
123125 const injector = Injector . create ( {
124126 parent : this . injector ,
0 commit comments