I need to add dinamically new viewmodel to master Viewmodel.
For example i have this struct:
var masterVm: {
vm1: {},
someProp : ko.observable(),
...
}
masterVm is refered to main.js and vm1 to another component.js.
I want to add to masterVm a newVm after page of newComponent.js is DOMed and it's script is loaded (by $.getScript() func self-containig code of vm2). I have to do this cause need to share observable var between viewmodel. I'm open also others alternatives.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire