I have developed a dynamic Angular component that utilizes content projection and slots in the following way:
<div class="content-wrapper">
<div class="short-wrapper" [style.opacity]="expanded ? 0 : 1">
<ng-content select="[short]"></ng-content>
</div>
<div class="full-wrapper" [style.opacity]="expanded ? 1 : 0">
<ng-content select="[full]"></ng-content>
</div>
</div>
This allows users to switch between viewing the contracted (short) or expanded (full) version of the component.
In addition, each component features an icon. My goal is to determine whether the [short]
content has been provided, and if not, substitute an enlarged version of the icon as the default contracted content for the component.
However, I am unsure how to achieve this check within the Typescript code of my component. If the [short]
content is absent, I want to dynamically adjust the CSS class of the icon to transform it from a small top-left icon to a larger centered icon, occupying the space intended for the short content.