Home » Backbone.js collection.reset()

Backbone.js collection.reset()

by Online Tutorials Library

Backbone.js collection.reset()

The Backbone.js collection reset is used to replace a collection with a new list of models. It updates the collection in bulk. It can reset the collection with a new list of models or will empty the entire collection.

It is different from adding and removing collection because they are good to change one at a time. On the other hand, Reset collection makes changes in bulk.

Syntax:


Parameter explanation:

models: It specifies names of the collection instances, which are need to be reset in the collection.

options: It contains null value to empty the collection.

Let’s take an example.

See this example:

You may also like