Is there a way to conditionally show slots in an angular template? I want to transclude content, if there is any, and show default content otherwise.
Let's say there's a my-card
component, with a template like this:
<my-card>
<ng-content select="[card-body]"></ng-content>
<div *ngIf="!card-body">Default text</div>
</my-card>
Then the usage (in, say, app component) would be like this:
<!-- This will show the card body -->
<my-card><div card-body>This is card body</div></my-card>
<!-- This will show the default text -->
<my-card></my-card>
If this won't work with slots, what are my alternatives?