[Angular] *ngIf syntx

<div class="profile">
  <img [src]="user.img" width="50px">
  @{{user.username}} has <strong>{{followerCount}}</strong> followers
  <div *ngIf="isFollowing; then unfollowButton else followButton">
      button renders here
  </div>
</div>
<ng-template #followButton>
  <button class="button is-info" (click)="toggleFollow()">Follow</button>
</ng-template>
<ng-template #unfollowButton>
  <button class="button is-warning" (click)="toggleFollow()">Unfollow</button>
</ng-template>
原文地址:https://www.cnblogs.com/Answer1215/p/8076580.html