diff --git a/.changeset/six-hounds-whisper.md b/.changeset/six-hounds-whisper.md new file mode 100644 index 000000000..706dcbeaa --- /dev/null +++ b/.changeset/six-hounds-whisper.md @@ -0,0 +1,5 @@ +--- +"@alauda/ui": patch +--- + +Fix/nested template dialog close error diff --git a/src/dialog/dialog.service.ts b/src/dialog/dialog.service.ts index 63d225f41..639526947 100644 --- a/src/dialog/dialog.service.ts +++ b/src/dialog/dialog.service.ts @@ -142,14 +142,19 @@ export class DialogService { this.ngZone, ); + const injector = this.createInjector(config, dialogRef, dialogIns); if (compOrTempRef instanceof TemplateRef) { dialogIns.attachTemplatePortal( - new TemplatePortal(compOrTempRef, null, { - $implicit: config.data, - } as any), + new TemplatePortal( + compOrTempRef, + null, + { + $implicit: config.data, + } as any, + injector, + ), ); } else { - const injector = this.createInjector(config, dialogRef, dialogIns); const contentRef = dialogIns.attachComponentPortal( new ComponentPortal(compOrTempRef, null, injector), );