![]() |
VOOZH | about |
The Backbone.js model Collection is the property that specifies the model collection. If this property is defined then we can pass objects, an array of objects, and uses options add, create and reset then the attributes will be converted into a model of the proper type using provided options.
Syntax:
collection. model( attrs, options ) ;
Parameters:
Example 1: In this example, we will illustrate the Backbone.js model Collection. We will define the model property of the collection which has default attributes and write them in the document.
Output:
Example 2: In this example, we will define the polymorphic model for the collection. Polymorphic model are model which are defined according to the condition which are attributes present in the model.