I am working on Ember.js classes to help with working with forms. In the snippet below, my definition of widget needs to bind to its value to a property of the object in which it is nested hence I set the binding to 'App.AjaxForm.aField.value'.
Is there a less repetitive way to say this?
App.Field = Ember.Object.extend({
// The Ember.js equivalent of ``django.forms.fields.Field``.
value: null,
errors: [],
widget: null
});
App.AjaxForm = App.Form.create({
action: '/ajax/',
fields: [
'aField'
],
aField: App.Field.create({
widget: Ember.TextField.extend({
valueBinding: 'App.AjaxForm.aField.value'
})
})
});
UPDATE: Added App.Field definition.
This is my solution.