models
can.Model.models
Deprecated 2.1
Prior to 2.1, .models
was used to convert the ajax
responses into a data format useful for converting them into an observable
list AND for converting them into that list. In 2.1, parseModels should
be used to convert the ajax responses into a data format useful to models.
Convert raw data into can.Model instances. Merge data with items in the store if matches are found.
can.Model.models(data[, oldList])
Parameters
-
data
{Array<Object>}
The raw data from a
findAll()
request. -
oldList
{can.Model.List}
OptionalIf supplied, this List will be updated with the data from data.
Returns
{can.Model.List}
A List of Models made from the raw data.
Use
.models(data)
is used to create a can.Model.List of can.Model instances with the data provided. If an item in data matches an instance in the store, that instance will be merged with the item's data and inserted in the list.For example