ViewModel
Summary
A representation of a data model, which has been reshaped into a form expected by a view.
Inspired by https://github.com/tommyh/backbone-view-model
Constructor
aeris.util.aeris.ViewModel
Syntax
aeris.util.aeris.ViewModel
(
-
opt_attrs
-
opt_options
Summary
Parameters:
-
opt_attrs
Object= -
opt_options
Object=-
data
Backbone.Model=Data model.
-
Item Index
Properties
Methods
destroy
Syntax
destroy
()
Summary
fetchData
Syntax
Summary
Invoke the 'fetch' method on our data model.
Parameters:
-
opt_options
Object=Options to pass to the aeris.Model#fetch method.
Returns:
getDataAttribute
Syntax
Summary
Returns an attribute of the data model at a given path.
Parameters:
-
path
String
Returns:
syncToModel
Syntax
syncToModel
()
Summary
Uses attribute transforms to sync the view model to the data model.
Properties
attributeTransforms_
Syntax
attributeTransforms_
Object.Summary
A hash of transforms to apply to attributes.
Example: { km: function() { return this.getData().get('miles') * 1.609344; } }
this.getData().set('miles', 3.0); this.get('km'); // 4.82803
data_
Syntax
data_
aeris.Model
private
Summary
Data model.