![]() |
VOOZH | about |
The Backbone.js modelId Collection is used to uniquely identify the models in the collection. By default, Collection uses idAttribute value of Model to identify the models. We can override our modelId function whose return value will be used by the collection to uniquely identify the Models.
Syntax:
collection.modeId( attrs, idAttribute );
Parameters:
Example 1: In this example, we will illustrate the Backbone.js modelId Collection. Here we will see the default modelId return idAttribute.
Output:
Example 2: In this example, we will customize modelId and make a unique identifier with the specified attribute of the model.