Skip to content

Commit fb87f73

Browse files
authored
Fix/nested template dialog close error (#570)
* fix: nested dialog created by template cannot close correctly * Create six-hounds-whisper.md * chore: update changeset description
1 parent 6f6c12b commit fb87f73

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

.changeset/six-hounds-whisper.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/ui": patch
3+
---
4+
5+
Fix/nested template dialog close error

src/dialog/dialog.service.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,19 @@ export class DialogService {
142142
this.ngZone,
143143
);
144144

145+
const injector = this.createInjector(config, dialogRef, dialogIns);
145146
if (compOrTempRef instanceof TemplateRef) {
146147
dialogIns.attachTemplatePortal(
147-
new TemplatePortal(compOrTempRef, null, {
148-
$implicit: config.data,
149-
} as any),
148+
new TemplatePortal(
149+
compOrTempRef,
150+
null,
151+
{
152+
$implicit: config.data,
153+
} as any,
154+
injector,
155+
),
150156
);
151157
} else {
152-
const injector = this.createInjector(config, dialogRef, dialogIns);
153158
const contentRef = dialogIns.attachComponentPortal<T>(
154159
new ComponentPortal(compOrTempRef, null, injector),
155160
);

0 commit comments

Comments
 (0)