Model
Summary
The base model class for Aeris JS Libraries
See http://backbonejs.org/#Model for documentation
Constructor
Item Index
Methods
Properties
Events
Methods
bindAttributesTo
Syntax
bindAttributesTo
-
target
-
attrs
Summary
Keep this model updated with values from the target model.
Immediately updates the model with the specified attributes, and updates this model whenever the target model's attributes change.
clone
Syntax
Summary
Create a copy of the model.
Parameters:
Returns:
getAtPath
Syntax
Summary
Returns a deep-nested property of a model attribute.
Example: model.set('deepObj', { levelA: { levelB: { foo: 'bar' } } });
model.getAtPath('deepObj.levelA.levelB.foo'); // 'bar'
Returns undefined if the path cannot be resolved.
Parameters:
-
path
String
isValid
Syntax
isValid
()
Summary
Validate the model's attributes.
normalize_
Syntax
Summary
This method is called every time attributes are set on the model.
Override to provide any additional processing needed for options object structure, etc.
Parameters:
-
attrs
Object
Returns:
Normalized attrs.
onValidationError_
Syntax
onValidationError_
-
model
-
error
Summary
Handle 'invalid' events thrown by the model.
Parameters:
-
model
Model -
error
ValidationError
set
Syntax
set
-
config
Summary
Normalize attributes before setting
Parameters:
-
config
Object
Properties
defaults
Syntax
defaults
Unknown
Summary
idAttribute
Syntax
idAttribute
Unknown
Summary
Events
add
Syntax
add
Summary
When a model is added to a {aeris.Collection}.
Event Payload:
-
model
aeris.Model -
collection
aeris.Collection
change
Syntax
change
Summary
When a model's attribute changes
Event Payload:
-
model
aeris.Model
change:[attribute]
Syntax
change:[attribute]
Summary
When a model's attribute changes, where [attribute] is the name of the attribute.
Event Payload:
-
model
aeris.Model -
value
remove
Syntax
remove
Summary
When a model is removed from a {aeris.Collection}.
Event Payload:
-
model
aeris.Model -
collection
aeris.Collection