Skip to content

Instantly share code, notes, and snippets.

@BharathRavi27
Last active September 12, 2020 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BharathRavi27/8db531bf978b521f459fc7af7bb311a7 to your computer and use it in GitHub Desktop.
Save BharathRavi27/8db531bf978b521f459fc7af7bb311a7 to your computer and use it in GitHub Desktop.
<div class="accordion">
<div class="accordion-head">
<button (click)="isOpen = !isOpen">{{ isOpen ? "-" : "+" }}</button>
</div>
<hr />
<div *ngIf="isOpen" class="accordion-content">
<ng-container *ngIf="accordionBodyRef; else eagerBody">
<ng-container *ngTemplateOutlet="accordionBodyRef"></ng-container>
</ng-container>
<ng-template #eagerBody>
<ng-content select="[accordionBody]"></ng-content>
</ng-template>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment