Created
January 8, 2018 22:57
-
-
Save natmegs/11d06af1ad6f85960eb608ed03c3ea5a to your computer and use it in GitHub Desktop.
Using <ng-template>
This file contains 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
<ng-template> | |
You will never see me :( | |
</ng-template> | |
<ng-template *ngIf="showContents"> | |
You still won’t see me (even though I’m using a structural directive, there’s nothing that's telling Angular to use me) | |
</ng-template> | |
<ng-template *ngFor="let item of items"> | |
No dice (same reason as *ngIf above) | |
</ng-template> | |
<div *ngIf="!showTemplate else template"> | |
Hello | |
</div> | |
<ng-template #template> | |
Finally I am seen! (When showTemplate is true) | |
</ng-template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment