I am having an issue while cloning objects. I have strategies array to which i am trying to add strategy objects.It works some times while errors with the following error message. Could somebody tell me what the problem could be. The strategy object consists of objects of objects. In the Add method , I am trying to add Strategy of element zero to the strategy array.
export interface Strategy {
domicile: Domicile;
captiveAssumption: StrategyCaptiveAssumption;
modelingAssumptions: StrategyModelingAssumption;
selectedLinesOfBusiness: SelectedLineOfBusinessInput[];
accountRules: StrategySpecialAccountRules;
minCapitalContribution: StrategyMinCapitalContribution;
results: Results;
}
Converting circular structure to JSON at JSON.stringify ()
add() {
if (!this.showAddStrategy) {
return;
}
const strategy: Strategy = JSON.parse(JSON.stringify(this.strategies[0]));
this.strategies.push(this.strategies[0]);
this.save.emit();
this._expandLastStrategy();
}