Maybe I'm overlooking something, but I from can't figure out how I'm supposed
I have a JSON coming from the server which looks like this
{
"articles": [
{
"user": {
"name": "user",
"username": "user",
"_id": "52755cba74a1fbe54a000002"
},
"_id": "5275698c53da846e70000001",
"__v": 0,
"content": "content",
"title": "title",
"created": "2013-11-02T21:07:24.554Z"
}
]
}
In the template, I'm accessing content and created fine, but when I try to get user.name, nothing comes out:
{{#each article in model}}
<span>{{ article.title }}</span>
<span>by {{ article.user.name }}</span>
<span>{{ article.created }}</span>
{{/each}}
I noticed that in the model, whatever I don't define, won't appear in the template, so it looks like this:
title: DS.attr('string'),
content: DS.attr('string'),
created: DS.attr('date')
But when I try to add:
user: {
name: DS.attr('string')
}
To match the nested json, I get an error.
Is ember not able to handle nested json? If it is, then how?
Thanks.