I have an Angular service which holds list of data in BehaviorSubject. When a component is requesting the data from the service, it will be passed there as an observable. In my understanding the data should be immutable in the component, but whenever I make changes to the data in the component, it also changes in the service.
So the problem is if user edits the data in edit view and then clicks cancel, the data has been already altered in service. I created a sample app to demonstrate the problem: https://stackblitz.com/edit/angular-ivy-jicj96
How should I store and pass on the data in service so that component cannot modify it directly?