http://jsfiddle.net/nf8NM/3/
This is my first foray into Backbone and I am simply trying to fetch an Api call from Dribbble.
I\'m trying to do it the most B
Not sure what your problem is. Rewriting a bit your collection class to separate the concerns, I get perfectly valid models.
Shot = Backbone.Model.extend({
initialize:function(opts) {
console.log("init shot : "+opts.id);
}
});
ShotsList = Backbone.Collection.extend({
model: Shot,
sync: function(method, model, options) {
var params = _.extend({
type: 'GET',
dataType: 'jsonp',
url: model.url(),
processData: false
}, options);
return $.ajax(params);
},
parse: function(response) {
return response.shots;
},
url: function() {
return "http://api.dribbble.com/players/" + encodeURIComponent(this.player) + "/shots?per_page=18";
}
});
s=new ShotsList();
s.bind("reset",function(collection) {
console.log(collection.models);
console.log(collection.pluck("image_teaser_url"));
});
s.player="jordan";
s.fetch();