'How to check 2 conditions in angular ngif

I am little stuck trying to get this *ngIf to work correctly. What I am trying to do is show the div if it is empty only if the user viewing is owner. If the user is a guest, and the div is empty, it should not be shown. here is what I have:

<div *ngIf="(tray.flyers.length === 0) && (isOwner === true)"></div>

That will show the div if the user is owner and the div is empty. I'm just not sure how to add the clause that will hide it if the user is a guest and the div is empty.

I have trying to figure this out for a couple hours and can't see to see how it would work.I know I can get this to work if I do everything in the component and just do:

<div[hidden]="isTrayEmpty"></div>

but I was really wanted to do this in the HTML if possible. I am not sure if it even can be done.

Thank you for any help if possible you could give.



Solution 1:[1]

It's logic: Show the div if its NOT empty OR the user is the owner:

<div *ngIf="(tray.flyers.length > 0) || (isOwner === true)"></div>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Turo