使用骨干收集从JSON服务的集合,我已经使用视图INITIALISE激活取,但是我现在想通过JSON阵列回到看法,但我米不能确定如何实现这一目标?传递骨干读取/初始化的变量视图
下面的代码是什么我目前使用:
app.AppView = Backbone.View.extend({
initialize: function(){
// Instanciate a new Form collection (which is derrived from the input model)
var inputs = new app.Form();
// Perform a GET on the model url to the service
inputs.fetch({
success: function() {
var questions = inputs.get(0).toJSON().Questions;
console.log(questions);
}, // End Success()
error: function(err){
console.log("Couldn't GET the service " + err);
}
}); // End Input.fetch()
this.render();
}, // End Initialize
render: function(){
el: $('#factfinder')
var template = _.template($("#form_template").html(), {});
this.$el.html(template);
}
}); // End AppView.Backbone.View.extend()