Hi I've and *ngIfcondition where I'm checking for negation using ||(or) operator but along with the ||, I also need to check for && condition.
Basically I'm checking if activeIndex is not 0 or 2. But now I also need to check for and condition like activeIndex is not 0 AND obj(object) is empty{} OR activeIndex is not 2
<div >
<ng-container *ngIf="!(activeIndex === 0 || activeIndex === 2); else otherSteppers">
// if condition some code
</ng-container>
<ng-template #otherSteppers>
// else some code
</ng-template>
</div>
How can I add condition activeIndex is not 0 AND obj(object) is empty{}.
I tried below code but it didn't work. Can anyone suggest what I'm doing wrong, if no how can we achieve such condition
<ng-container *ngIf="!(activeIndex === 0 && (obj | json) == '{}' || activeIndex === 2); else otherSteppers"></ng-container>
CodePudding user response:
check this out
<ng-container *ngIf="(activeIndex !== 0 && (obj | json) == '{}') || activeIndex !== 2; else otherSteppers"></ng-container>
CodePudding user response:
You can try this using KeyValuePipe also as shown below.
<ng-container *ngIf="(activeIndex === 0 && !(obj | keyvalue)?.length) || activeIndex === 2); else otherSteppers"></ng-container>
