I have two knockout models. On a change event in one model I want to access the property of the second model and modify it. I am not able to get the value from the second model.
First Model
var firstModelVM = function (data, root) {
ko.observableListItem.call(this, data);
var self = this;
this.id = ko.observable();
this.isPercentAvailable = ko.observable();
this.name = ko.observable();
enableCentralImp: function (data, event) {
var select = $(event.target).is(':checked');
this.elementID
}
Second Model
var secondModelVM = function (data, root) {
ko.observableListItem.call(this, data);
var self = this;
this.defaultValue = null;
this.defaultPercentage = null;
this.isMoney = null;
this.elementID = null;
this.overrideValue = ko.observable();
this.overridePercentage = ko.observable();
this.comments = ko.observable();
}
I am trying to access the elementID property of secondModelVM inside the firstModelVM so I can modify it. Can some one please tell me how to do this.
Thanks