Skip to content

Commit

Permalink
Merge pull request #2588 from IDEMSInternational/hotfix/template-cont…
Browse files Browse the repository at this point in the history
…ainer-error-alt

fix: template container error alt
  • Loading branch information
jfmcquade authored Dec 3, 2024
2 parents 6662b2a + 0e7a0e3 commit f300b87
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/app/shared/components/template/template-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class TemplateContainerComponent implements OnInit, OnDestroy {
/** unique instance_name of template if created as a child of another template */
@Input() name: string;
/** flow_name of template for lookup */
templatename = input.required<string>();
templatename = input<string>();
/** reference to parent template (when nested) */
@Input() parent?: TemplateContainerComponent;
/** reference to the full row if template instantiated from a parent */
Expand Down Expand Up @@ -77,12 +77,20 @@ export class TemplateContainerComponent implements OnInit, OnDestroy {
public elRef?: ElementRef,
private route?: ActivatedRoute
) {
effect(() => {
// re-render template whenever input template name changes
const templatename = this.templatename();
this.hostTemplateName = templatename;
this.renderTemplate(templatename);
});
effect(
() => {
// re-render template whenever input template name changes
// TODO - this isn't passed when running standalone. Should ideally de-couple render/service logic
const templatename = this.templatename();
if (templatename) {
this.hostTemplateName = templatename;
this.renderTemplate(templatename);
}
},
// NOTE - pass the injector from the constructor as angular will not be able
// to auto-determine injector when called from a standalone template
{ injector }
);
this.templateActionService = new TemplateActionService(injector, this);
this.templateRowService = new TemplateRowService(injector, this);
}
Expand Down

0 comments on commit f300b87

Please sign in to comment.