I have an array of objects that is an input. Lets call it content.
When trying to deep copy it, it still has a reference to the previous array.
I found deep copy method in angular devkit, It's very normal, so... maybe you can just implement yourself or use that.
I prefer to use loadash, there a lot of objects and array operation methods that can use.
import { deepCopy } from '@angular-devkit/core/src/utils/object';
export class AppComponent {
source = {
....
}
constructor() {
const newObject = deepCopy(this.source);
}
}
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1000.8
@angular-devkit/build-angular 0.1000.8
@angular-devkit/build-optimizer 0.1000.8
@angular-devkit/build-webpack 0.1000.8
@angular-devkit/core 10.0.8
@angular-devkit/schematics 10.0.8
@angular/cli 10.0.8
@ngtools/webpack 10.0.8
@schematics/angular 10.0.8
@schematics/update 0.1000.8
rxjs 6.5.5
typescript 3.9.7
webpack 4.43.0