Open jekuno opened 9 years ago
I suppose this issue is caused by the underscore library which is used by epoxy. Collection function such as _.each
and _.map
internally use an isArrayLike
function which uses duck-typing to identify array like objects by looking for a length
attribute.
This is what the documentation of http://underscorejs.org/#each says:
Collection functions work on arrays, objects, and array-like objects such as arguments, NodeList and similar. But it works by duck-typing, so avoid passing objects with a numeric length property.
I worked around this issue by renaming the length
attribute. What do you think about adding an according hint to the documentation?
There's a bug in Epoxy with model attributes called
length
.Let's say I have an app which stores measures of vegetables e.g.
weight
andlength
. The default Epoxy setup doesn't work: http://jsfiddle.net/7dddfuh8/0/The error message in the provided example:
The same setup works when renaming all
length
attributes: http://jsfiddle.net/7dddfuh8/1/