I need to create a model that has this structure:
name: 'xyz', relatives: [ {name:'abc',age:'123'},{name:'def',age:'123'}..... ]
I have a loop that generates data for relatives at each iteration. And I have a model in such a state as:
window.Persons.name='xyz'
TWO QUESTIONS
How to copy relatives data to this model? I need to understand how to build model instances with nested object structures at any level?
I set the model context to the window object so that it is available in all views when I collect data from different views. How does the name gather in some other views and relatives in some other way, and this continues ... So am I doing the right thing? Or am I polluting the global namespace.
Please shed some light, because I am sure that I lack a fundamental understanding here.
source share