Created
November 15, 2019 15:23
-
-
Save agustinhaller/bf54d693f08e336a8ee24e3c161dc32a to your computer and use it in GitHub Desktop.
Angular Templates Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="product-expanded-details col-5 col-lg-6" *ngIf="(_mode === 'expanded')"> | |
<!-- Conditional template Outlet (see: https://stackoverflow.com/a/52448001/1116959) --> | |
<ng-container *ngTemplateOutlet="_product?.highlighted ? highlightedDetails : normalDetails; context: { product: _product }"> | |
</ng-container> | |
</div> | |
</div> | |
<!-- Product - Normal Details template --> | |
<ng-template #normalDetails let-product="product"> | |
<div class="variant-details" *ngIf="product?.type === 'single' || product?.type === 'multi'"> | |
<ng-container *ngTemplateOutlet="productVariant; context: { variant: product?.selectedVariant }"></ng-container> | |
</div> | |
<div class="bundle-details" *ngIf="product?.type === 'bundle'"> | |
<ng-container *ngTemplateOutlet="productBundle; context: { bundle: product }"></ng-container> | |
</div> | |
</ng-template> | |
<!-- Product - Highlighted Details template --> | |
<ng-template #highlightedDetails let-product="product"> | |
<cc-background-pattern class="highlighted-details-background-pattern" pattern="non-repeatable-shapes"> | |
<ng-container *ngTemplateOutlet="normalDetails; context: { product: product }"></ng-container> | |
</cc-background-pattern> | |
</ng-template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment