What is the most efficient way to clone a primeNG tree object which have Circular Structure? I've done things like
obj = JSON.parse(JSON.stringify(o));
//but JSON.stringify() not working for Circular Structuure.var newObject = jQuery.extend(true, {}, oldObject);
let newObject = this.copyObj(oldObject); copyObj(obj) { // This is done because we need a copy of list, without this code it will copy a ref which will update file badges on create screen without add button click return [obj[0]]; }
let newObject = Object.assign({}, oldObject);
But all this method Copy Object ByReference not ByValue