Any help with *ngIf directive in my chat app

hello guys, i’m building a chat app where user can send picture to other. Here is my json response

and my html code :

<div class="chat-bubble right slide-right">
            <div class="message">
                <p><img [src]="contents.attachment.url" *ngIf="contents.attachment.url"  />
          <div class="message-detail">
            <span>{{ | lowercase}}</span>

i want to hine the picture if it doesn’t one. any help please !!!

<p *ngIf="contents.attachment !== undefined"><img [src]="contents.attachment.url" *ngIf="contents.attachment.url"  />

that works. Thanks:wink:

You could also simplify the check to be

Which is smaller, naturally, as well as handling more cases than it simply being undefined.