Let's say I have this code to fetch data from my mongoDB collection :
app.get('/users', (req, res) => {
db.collection('users').find({}).toArray(function(err, data){
if (err) throw err;
res.json(data)
})
});
Then in my HTML, I call it like this :
<div *ngFor="let user of users">
<li class="text-white">{{ user['username'] }}</li>
</div>
But it's an array, I remember when I started learning Angular, I was calling like this :
{{ user.username }}
But I can't seem to remember how it worked exactly, I guess I would have to get rid of my
toArray()
in my app.js, but to what exactly ?
Sorry if my question seems noob, I'm quite new.
Thank you all