Is it possible to have two view model functions in my JavaScript where one references the other? I am encountering an error with this setup. Here are my view models:
var userViewModel = function (data) {
var _self = this;
_self.ID = ko.observable(data.ID);
_self.Name = ko.observable(data.Name);
//_self.ShowLetter = ko.computed(function () {
// return (typeViewModel().UserCount() > 13);
//});
_self.Letter = ko.observable(data.Letter);
};
Second view model:
var typeViewModel = function (data) {
var _self = this;
_self.ContentType = ko.observable(data.ContentType);
_self.TypeName = ko.observable(data.TypeName);
_self.UserCount = ko.observable(data.UserCount);
_self.Users = ko.observableArray([]);
};
After uncommenting certain lines in the first view model, the app throws an error in the console stating that it cannot find the property for ContentType. What could be the issue?