Current scenario:
function Employee(data) {
var self = this;
// variables
this.Forename = ko.observable(data.Forename);
this.Surname = ko.observable(data.Surname);
this.Save = function () {
var obj = JSON.stringify(self); // Without ko.observables, this works fine. self() doesn't work obviously.
console.log(obj);
};
}
I think what I'm trying to do is pretty straight forward, get all the observable values without going through every single one of them, and creating a JSON string using the stringify function. This is easy to do without observables, is there a simple way to do it with them?