Ik have a JavaScript object with lots of properties and calculated properties (which are functions), which I want to send to the server. Now when I call this method
resource.save({ id: vm.allData.id }, vm.allData);
(where vm.allData holds the object) only the properties are serialized, and not the results of the functions.
Is it possible to serialize function results also?
So as an example this little object
function Example() {
var obj = this;
this.propa = 5;
this.propb = 10;
this.total = function () {
return obj.propa + obj.propb;
}
}
I want to serialize property propa
, property propb
and (calculated) property total
Is that possible?