Allow definition of nested model relationships with dotted notation#91
Allow definition of nested model relationships with dotted notation#91gsxdsm wants to merge 2 commits intoarturadib:masterfrom gsxdsm:master
Conversation
Allow definition of nested model relationships with dotted notation:
obj.model.set({person:{name:'John Doe'}})
can now be addressed with 'person.name' in data bindings as well as
obj.model.get('person.name')
Events are also specified with dotted notation
'change:person.name':function(){}
There was a problem hiding this comment.
hmm, we seem to have some indentation issues here - perhaps you're using tabs and not spaces? we use spaces in Agility
|
This looks good to me, really like those tests. @tristanls ? |
There was a problem hiding this comment.
it seems that this would allow setting a property referenced by an empty string:
data-bind=".oops"which will try to generate a structure of:
model._data[ '' ] = { oops : 'value' };This is not a bad thing in itself, and perhaps some future convention can have special meaning for variables ".myFoo" as a result of that, just thinking out loud here.
|
Made a note on code and I'm rusty getting back to ui development, but taking a quick look nothing breaking jumped out. |
|
What about 'person.addresses.0.street', 'person.addresses.1.street' ? PS: I'm just starting with Agilityjs. I've tested Backbonejs, Knockoutjs, Angularjs, Emberjs, but Agilityjs is the one that fits my way of programming the best. It's really a clever piece of code, thanks Artur. I hope that you will find more time to take care of it. |
Allow definition of nested model relationships with dotted notation:
obj.model.set({person:{name:'John Doe'}})
can now be addressed with 'person.name' in data bindings as well as
obj.model.get('person.name')
Events are also specified with dotted notation
'change:person.name':function(){}