Currently, I am engaged in a project using Ember where I retrieve a complex JSON response in a Route
's model
function. In the associated template, I exhibit attributes of the response. Some of these attributes allow for specific actions that result in modifications to the model.
I aim to have these changes instantly reflected in the interface through Ember's binding feature. Regrettably, although accessing a top-level attribute from the JSON response in the ObjectController
via this.get('attributeFromJson')
is successful, attempting the same action on a child property does not yield the desired outcome.
To illustrate the issue, I have created the following JSFiddle: http://jsfiddle.net/KkD6U/
My understanding is that I must manually convert the response into an Ember.Object
to leverage its Ember.Observable
capabilities.
My question is: Is there a straightforward Ember method to automatically "deep-wrap" an entire JSON response into a structure comprised of Ember.Object
instances for utilizing get
and set
across the entire response? How would one accomplish this in plain Ember?
Update:
Subsequently, I devised a basic function to transform regular JavaScript objects into Ember objects, view the jsFiddle here: http://jsfiddle.net/5vEcL/1/
Does this approach seem viable?