How to hide HTML template if a variable value is null

How to hide HTML template if a variable value is undedfined/null
below my json response

guardReport_id 27
|user_id|42|
|guard_time1|09:39|
|guard_location1|North fence|
|guard_cmnt1|sasa|
|guard_time2|null|
|guard_location2|null|
|guard_cmnt2|null|
|guard_time3|null|

I do not want to see the null values in my html template
Thanks

Hi, @flycoders_sourav, try:

<div *ngIf="guard_time2">{{ guard_time2 }}</div>

Cheers!

1 Like

Use *ngIf directive in div tag