Hello everyone, I am a newcomer to Angular and the entire MEAN stack ecosystem.
Currently, I have a MongoDB database collection structured like this:
db.users({
username: "Test1",
fname: "Bob",
lname: "Saget",
email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="196d7c6a6d596d7c6a6d377a7674">[email protected]</a>",
password: "12345",
status: [{
active: false,
"non-active": false,
suspended: true,
"un-confirmed": false,
banned: false
}]
})
So far, I have been able to successfully display all users on the screen using the following code snippet:
<tr ng-repeat="user in users">
<td>{{user.username}}</td>
<td>{{user.fname + ' ' + user.lname}}</td>
<td>{{user.email}}</td>
<td>{{user.password}}</td>
<td></td>
</tr>
However, my challenge arises when attempting to display the name of the field (e.g., 'suspended') from the status array based on its boolean value instead of displaying 'true'. Moreover, I only want to retrieve the records with true values (there will be only one in this case).
I have tried utilizing combinations of ng-if along with ng-repeat and filter:{} options without much success.
If necessary, I can provide additional details. How would you approach solving this issue?
Thank you very much in advance for any insights or guidance you can offer!