arturadib / agility

Javascript MVC for the "write less, do more" programmer
http://agilityjs.com
MIT License
542 stars 70 forks source link

Allow definition of nested model relationships with dotted notation #91

Open gsxdsm opened 12 years ago

gsxdsm commented 12 years ago

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

arturadib commented 12 years ago

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

tristanls commented 12 years ago

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

golgote commented 11 years ago

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.