I have a deep jSon structure to deal with so I currently implement promises directly into the Ember Model (not dependant on Ember Data).
This is shown as follows: -
return Ember.$.getJSON('/ProcessManager/manage type=submitters&action=getSubmitters').then(function(data) {
var submitters = [];
$.each(data, function(i, item) {
$.each(item, function(i, item) {
$.each(item, function(i, item) {
Push each submitter into submitter array
submitters.push(item);
});
});
});
return submitters;
});
An example complete jSON response from this URL is as follows: -
{"submitters":{"signsubmitter.jar":{"SignSubmitter":{"description":null,"name":"com.form.custom.submitters.SignSubmitter","jarName":"signsubmitter.jar"}},"custom-classes.jar":{"OutputDirSubmitter":{"description":"Writes the XML to a directory.","name":"com.form.custom.submitters.OutputDirSubmitter","jarName":"custom-classes.jar"},"XMLResponseSubmitter":{"description":"Returns the XML file to the client.","name":"com.form.custom.submitters.XMLResponseSubmitter","jarName":"custom-classes.jar"},"ChainProcess":{"description":"Chain the output file to another process.","name":"com.form.custom.submitters.ChainProcess","jarName":"custom-classes.jar"}}},"success":true}
I have read this URL: http://emberjs.com/guides/models/connecting-to-an-http-server/
I would like to know people's opinion on transitioning to Ember Data with this type of data.
Thank you.