In many cases working with Backbone, I am expecting to be able to call $model['propertyName']
based on what I am seeing in the Alloy documentation and other libraries. However this is causing undefined
errors, which appear to be resolved by calling $model.attributes['propertyName']
instead. By inspecting a Backbone model object, I understand that Backbone nests the object's properties inside of attributes
, but I am afraid that I am doing something wrong. Is Backbone supposed to recognize what I mean by $model.name
even though the object's true structure is $model.attributes.name
?
↧
$model['propertyName'] or $model.attributes['propertyName']?
↧