OK. Here we go. I'm trying to build simple app with MEAN. And when I show my object with angular {{object}}
it prints the object on my page but when I try to print object property {{object.property}}
nothing happens.
Below is the relevant part of the code. How do you print property of the object?
Mongo
> db.myapp.find().pretty()
{
"_id" : ObjectId("564983745dc4b169cba8c9fc"),
"type" : "balance",
"value" : "111"
}
Server code
app.get('/myapp', function (req,res) {
db.myapp.find(function(err,docs){
res.json(docs);
});
});
Controller
$http.get('/myapp').success(function (response) {
$scope.balance = response;
});
HTML
<p>{{balance}}</p>
<p>{{balance.type}}</p>
<p>{{balance.value}}</p>
Result with the above HTML is following.
[{"_id":"564983745dc4b169cba8c9fc","type":"balance","value":"111"}]