我的模特:
var UsersID = Backbone.Collection.extend({
model:Wine,
url:"api/wines/id"
});
我的观点:
var EditUser = Backbone.View.extend({
el: '.page2',
render: function (options) {
//console.log(options.id);
var wine = options.id;
//console.log(wine);
var that = this,
users = new UsersID({ id:wine });
users.fetch({
success: function (users) {
var template = _.template($('#user-details-template').html(), {users: users.models});
that.$el.html(template);
}
})
}
});
无法正常工作:型号网址未收到数据。
答案 0 :(得分:0)
这是我的方式:
users.url = 'api/wines/' + id;
users.fetch({
success: function (users) {
var template = _.template($('#user-details-template').html(), {users: users.models});
that.$el.html(template);
}
})