Clean solution for nested observable objects
This is the structure of the object that we are trying to solve for var cust = { firstname : "Gamer", lastname : "Pro", address : { line1 : "1600 Amphitheatre Pkwy", line2: "", city: "Mountain View", state: "CA", zip:"94040" } }
Q1: If I want to watch changes on the object. Lets say update the street address line 1, what would be the general format to modify it.
Should I do custObservable.set("adresss.line1") or get the address and then do a set?
Q2: In the case of Q1, what "change" would i receive on the observable? Should I get one for adress or should i get one for street address.line1? Should I get two update one for line1 and one for address
The question doesn't assume any frameworks specifically. Feel free to share how this is solved in your favorite frameworks.