model.isNew

isNewmodel.isNew() Has this model been saved to the server yet? If the model does not yet have an id, it is considered to be new.

collection.clone

clonecollection.clone() Returns a new instance of the collection with an identical list of models.

collection.toJSON

toJSONcollection.toJSON([options]) Return an array containing the attributes hash of each model (via toJSON) in the collection. This can be used to serialize and persist the collection as a whole. The name of this method is a bit confusing, because it conforms to JavaScript's JSON API. var collection = new Backbone.Collection([ {name: "Tim", age: 5}, {name: "Ida", age: 26}, {name: "Rob", age: 55} ]); alert(JSON.stringify(collection));

collection.where

wherecollection.where(attributes) Return an array of all the models in a collection that match the passed attributes. Useful for simple cases of filter. var friends = new Backbone.Collection([ {name: "Athos", job: "Musketeer"}, {name: "Porthos", job: "Musketeer"}, {name: "Aramis", job: "Musketeer"}, {name: "d'Artagnan", job: "Guard"}, ]); var musketeers = friends.where({job: "Musketeer"}); alert(musketeers.length);

Backbone.off

offobject.off([event], [callback], [context])Alias: unbind Remove a previously-bound callback function from an object. If no context is specified, all of the versions of the callback with different contexts will be removed. If no callback is specified, all callbacks for the event will be removed. If no event is specified, callbacks for all events will be removed. // Removes just the `onChange` callback. object.off("change", onChange); // Removes all "change" callbacks. object.off("change")

collection.min

min

route:[name] event

"route:[name]" (params) â Fired by the router when a specific route is matched.

view.remove

removeview.remove() Removes a view and its el from the DOM, and calls stopListening to remove any bound events that the view has listenTo'd.

collection.initial

initial

collection.length

lengthcollection.length Like an array, a Collection maintains a length property, counting the number of models it contains.