I am working with some JSON and want to display the menu in angular only if the image is not null, example JSON is as follows, so if image is null don't show the component, any idea how to loop through this JSON in HTML, I am working on Angular.
Json:
users = [
{
user: [
image: 'user1.png',
data: {
name: 'abc'
}
]
}
{
user: [
image: null,
data: {
name: 'xyz'
}
]
},
{
user: [
image: 'user1.png',
data: {
name: 'xyzz'
}
]
}
]
Html
<div *ngFor="let user of users">
// want to show this component only if there is image
// want to do something like that
// ngIF="user.image != null" then show but its not working
<user-image [user]="user"></user-image>
</div>
*ngIf='user.image'check with this.usersis not JSON,usersis a JavaScript object.