I'm trying to call a function of the object from another function and I get "Undefined is not a function" error. I think there's some silly mistake but I can't figure it out.
function dataProvider() {
var self = this;
self.loadData = ko.computed(function(){
var data = new Data(self.getJson().data); //here comes the error
...
});
self.getJson = function(){
if(typeof jsonVar !== 'undefined')
return jsonVar;
else {
...
}
};
}
The jsonVar is defined and it is a valid JSON. Data is an object, but self.getJson() just doesn't work.
EDIT: It is not about calling private or public method. The problem is that I can't call the method of the object.