I have the following json
data:
{
"type": "type1",
"name": "Name1",
"properties": {
"age": 23,
"address": "Sample"
}
}
I am modelling this with Ember Data
, as follows:
App.Node = DS.Model.extend({
type: DS.attr('string'),
name: DS.attr('string'),
properties: DS.belongsTo('App.NodeProperties')
});
App.NodeProperties = DS.Model.extend({
age: DS.attr('number'),
address: DS.attr('string')
});
Is there a better way to model the nested properties
than using a DS.belongsTo
?
How would I access the age in my templates. I am currently doing
{{node.properties.age}}
But I am not sure this is working.