If-Then-Else construction In Angular
April 14, 2018
In Angular, using ngIf structural directive, we can achieve if-then-else functionality like below: myComponent.html: <p *ngIf=“myProperty ; else elseTemplate”> This element is rendered if myProperty is true </p> <ng-template #elseTemplate> <p> This element is only rendered if myProperty is false </p> </ngTemplate> myComponent.ts … … export myComponent { myProperty: boolean = false; } ============================== … More If-Then-Else construction In Angular