Saturday, 15 June 2013

backbone.js - Access a Backbone model from a collection.where -



backbone.js - Access a Backbone model from a collection.where -

i'm using method where on backbone collection so:

var quote = app.collections.quotes.where({id: parseint(id, 10)});

however, access result/model (as it's id, there's going one) - how can actual model without resorting using this:

var onlymodel = quote[0] ?

is there improve way?

a improve way utilize get on collection. http://backbonejs.org/#collection-get

var quote = app.collection.quotes.get(parseint(id, 10));

backbone.js

No comments:

Post a Comment