Shortly: I've got a shared component that displays tree. It has defined ngTemplateOutlet so whatever is using it may override the basic template. So far so good.
Now, I've got a AComponent that is using this tree component, but it doesn't override the node template (the default one is used).
I needed to add small adjustment to the AComponent, so I've created BComponent with some additional functionality and now I would like to override the default template, but I'm not sure how to do it.
It looks like this:
// tree component
...
<ng-container
[ngTemplateOutletContext]="{ $implicit: node }"
[ngTemplateOutlet]="nodeTemplateRef ? nodeTemplateRef : defaultNodeTemplate"
></ng-container>
...
// AComponent
<app-tree></app-tree>
// BComponent
<app-a>
<ng-template #nodeTemplate let-node>
...
</ng-template>
How to do that?
stackblitz example:
https://stackblitz.com/edit/angular-sshpug