#Hi, how do I create an if else condition in angular html code?

4 messages · Page 1 of 1 (latest)

patent merlin
#

I'll answer the question in the title, but I didn't understand the body:

<div *ngIf="someCondition; else somethingElse">...</div>
<ng-template #somethingElse>...</ng-template>
swift scaffold
#

how do i do that with this already existing:

ngIf="modalType === 'save' || modalType === 'activate'"
patent merlin
#

What you have inside the ngIf is the condition. You add the else after as shown in my answer

wide hawk
#

The "else" syntax for NgIf is one of my least favorite things in the framework.