I would like to know if it is possible to make a binding between two objects ( viewmodel
), the first is created as part of the function and the other is created from the Get
, and the property that you would like to synchronize between the two viewModels
is visibleTabs
with ultimoNivel
with KnockoutJS.
My current code is as follows:
var vm = function() {
var self = this;
this.visibleTabs = ko.observable(false);
this.select = function(e) {
var idEquipo = treeview().dataItem(e.node).id;
var equipo = Get("equipo/getbyid/" + idEquipo).responseText;
self.equipo(ko.mapping.fromJS(JSON.parse(equipo)));
self.visibleTabs(self.equipo().ultimoNivel());
}
this.visibleTabsChange = ko.computed(function () {
if (self.equipo()) {
self.equipo().ultimoNivel(self.visibleTabs());
}
});}