When I declare an array on an @Injectable provider, my intention is to use it across different components.
normeList: any[] = [
{
name: 'choice 1',
type:'false'
},
{
name: 'choice 2',
type:'false'
}
];
In a component, I assigned the array in this way:
this.myArray = [].concat(this.sharedListDeclarationProvider.normeList);
As I work with myArray
in the view, I modify the type
value from false to true;
The issue arises when the changes made to 'myArray' affect both the component itself and the original normList
in the provider service.
I am seeking guidance on how to update the values of myArray
without impacting the contents of normeList
in the provider.