We can now have else
snippets, referring to an <ng-template>
:
<div *ngIf="condition; else not">
Condition satisfied.
<ng-template #not>
Condition not satisfied.
</ng-template>
</div>
I would like to be able to refer to snippets outside of the context of an *ngIf
--something like
<div>DIV1 <ng-template-call template="shared"></ng-template-call></div>
<div>DIV2 <ng-template-call template="shared"></ng-template-call></div>
<ng-template #shared>This is a shared snippet.</ng-template>
What is the correct way to write what I have called ng-template-call
above?
Yes, I know I could make this into a separate component, but it does not rise to that level. And I could always write:
<div *ngIf="false; else shared">
but that seems clumsy.