Popular = Simple for simple things. Easy for hard things.
Building a simple App, all I want is get some JSON object from the server, mark it up and provide navigation to some other objects, no fancy binding just plain old JSON with markup and simple navigation.
So I read my model as:
App.ProjectsRoute = Ember.Route.extend({
model: function () {
return Ember.$.getJSON("api/project");
},
});
Where the JSON looks like this:
{ "header":"This is the header",
"Users": [
{ "Id": 1, "User": "Tom", "LastName": "Dale" }
,{ "Id": 2, "User": "Jason", "LastName": "Mitchell" }
] }
This model (JSON) object has some properties on it and some nested arrays. One would think that a simple #each in handlebars would do the trick in the template but - heck nada - no nothing.
Like this: (abbreviated, not Users is array of objects, all objects have a User attribute)
<h2 >Project {{ProjectAttachment}}</h2>
<p><dl class="dl-horizontal">
<dt>Description:</dt><dd>{{header}}</dd>
</dl>
{{Users}}
{{#each Users}} {{User}} {{/each}}<br />
So - why is this so hard - is it really necessary to have a whole Ember Data model defined with all the PITA associated with it to just âshow a nested objectâ?
I gotta be on the wrong path here.