原谅我,因为我是Ember的新手。对我来说,我有一个相当复杂的json对象,我正在使用它。
https://gist.github.com/bungdaddy/11152304
我的尝试是使用Ember.Object构建一个Model,使用reopenClass为几个方法返回我将在我的把手模板中使用的JSON对象的“sections”。
var Prequalification = Ember.Object.extend();
Prequalification.reopenClass({
template: function(){
return $.getJSON("http://myurl/prequalification")
.then(function(response){
var prequalification = [];
var template = response.collection.template.data
template.forEach(function(data){
prequalification.push(Prequalification.create(data));
});
console.log(template);
return prequalification;
});
},
businessType: function(){
//Here is where I would like to build a method that will pull from template, the particula JSON that I need and return below.
return ["Me","Myself","I"];
}//I wish to further extend from here, other methods that I may need to fulfill model requirements.
});
我很可能需要一个ArrayController来管理这些模型。我读了这么多,汇编了很多不同的变化,我很遗憾。所有这一切的清晰度对我来说都是一个很大的帮助。我可以处理简单的JSON对象,它是踢我的^&& ^ $ ^的复杂模型(* ^#