Skip to content

Commit

Permalink
use ng-template when using ngIf
Browse files Browse the repository at this point in the history
  • Loading branch information
wwelling committed Sep 13, 2021
1 parent c73dcf4 commit 8ae014a
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<li *ngIf="href" class="nav-item">
<a class="nav-link d-flex align-items-center justify-content-center" [href]="href">
<ng-content></ng-content>
<ng-container *ngTemplateOutlet="contentProjection"></ng-container>
</a>
</li>

<li *ngIf="!href" class="nav-item d-flex align-items-center justify-content-center">
<ng-content></ng-content>
<ng-container *ngTemplateOutlet="contentProjection"></ng-container>
</li>

<ng-template #contentProjection>
<ng-content></ng-content>
</ng-template>

0 comments on commit 8ae014a

Please sign in to comment.