Angular *ngIf else

agnusdei·2023년 7월 5일
0
<ng-container *ngFor="let dot of [].constructor(8); index as i">
    <img
      src="assets\icon\double_circle.svg"
      class="w-4 h-4"
      *ngIf="i === visibleIndex; else none"
    />
    <ng-template #none>
      <div class="bg-white/50 rounded-full w-1.5 h-1.5"></div>
    </ng-template>
  </ng-container>
  1. 일반 if else 와 동일하게 동작합니다.

  2. else 변수명 : 사용 시 반드시 <ng-template #변수명> 으로 명시해야 하며, ng-template 태그를 사용해야 합니다.

0개의 댓글