DEV Community

Mustafa Omran
Mustafa Omran

Posted on

How To Use *ngIf else In Angular 2+

Use *ngIf Directive with ng-template associated with reference #refernece_name

<section *ngIf="isAllowed else otherSection">
   Allowed Section
</section>
<ng-template #otherSection>
  <section>
    Other Section 
  </section>
</ng-template> 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)