agility icon indicating copy to clipboard operation
agility copied to clipboard

Allow definition of nested model relationships with dotted notation

Open gsxdsm opened this issue 12 years ago • 3 comments

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(){}

gsxdsm avatar Aug 13 '12 02:08 gsxdsm

This looks good to me, really like those tests. @tristanls ?

arturadib avatar Aug 15 '12 14:08 arturadib

Made a note on code and I'm rusty getting back to ui development, but taking a quick look nothing breaking jumped out.

tristanls avatar Aug 15 '12 15:08 tristanls

What about 'person.addresses.0.street', 'person.addresses.1.street' ? Or better 'person.addresses[0].street' ? Maybe something like this too : this.model.get('person.addresses.$.street'), to get all streets for example ? This can be useful as well, what do you think ?

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.

golgote avatar Nov 04 '12 11:11 golgote