Skip to content

Commit

Permalink
Fix/nested template dialog close error (#570)
Browse files Browse the repository at this point in the history
* fix: nested dialog created by template cannot close correctly

* Create six-hounds-whisper.md

* chore: update changeset description
  • Loading branch information
yangxiaolang authored Jun 27, 2024
1 parent 6f6c12b commit fb87f73
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-hounds-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alauda/ui": patch
---

Fix/nested template dialog close error
13 changes: 9 additions & 4 deletions src/dialog/dialog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(
new ComponentPortal(compOrTempRef, null, injector),
);
Expand Down

0 comments on commit fb87f73

Please sign in to comment.