I am trying to return a value of an objects that are inside of an array.
const bugSchema = new Schema({
title: {
type: String,
required: true
},
comments:[
{
user:{
type: String,
required: true
},
content: {
type: String,
required: true
}
}
]
});
I have tried the following function but it does not return anything.
<% for (bug of bugs) { %>
<ion-card>
<ion-card-header>
<ion-card-title><%= bug.comments.filter(function (value) { value.content }) %></ion-card-title>
</ion-card-header>
<ion-card-content>
</ion-card-content>
</ion-card>
<% } %>
However I can return an array but it returns the entire objects rather than value of each one.
<% for (bug of bugs) { %>
<ion-card>
<ion-card-header>
<ion-card-title><%= bug.comments %></ion-card-title>
</ion-card-header>
<ion-card-content>
</ion-card-content>
</ion-card>
<% } %>
The screenshot below shows how the object looks like
What I am expecting to achieve is to create a ion-card populated with comment's content.
