Not sure if his mistake or misunderstanding of how things should work:
- disable single instance mode
- Create a new parsing object (or request it from the server) and fill in the properties
- Make a copy of the object (for example, if you edited the properties on the form and wanted to save the changes / discard the changes)
- The copy is empty ....
using parse-js-sdk 1.9.2 and angular 1.4.8
Parse.Object.disableSingleInstance();
var parseObjClass = Parse.Object.extend('Comments', {
initialize: function (attrs, options) {}
},
{});
['name', 'desc'].forEach(function (item) {
Object.defineProperty(parseObjClass.prototype, item, {
get: function () {
return this.get(item);
},
set: function (aValue) {
return this.set(item, aValue);
}
});
});
var parseObj = new parseObjClass();
parseObj.name = 'Hello World'
parseObj.desc = 'Test Object'
console.log('original is ' + JSON.stringify(parseObj));
var objCopy = angular.copy(parseObj);
console.log('copy is ' + JSON.stringify(objCopy));
Here is the plunker illustrating https://plnkr.co/edit/UjWe9dl6D6Qkx9ihBSMC
background: disableSingleInstance, -, ( ) js-sdk, ...