Double way binding and shared List

38 Views Asked by At

In my application I have a quite big set of Data Preloaded at startup and stored in ContextManager.allSkills (a Map<int, Skill> where Skill is a custom class).

Now, in a component I have a data-table that shows that data and can filter and sort them out. I just realized that since my ContextManager.allSkills is shared in all application the stuff I do in a page, is reflected in the other one. For example if I filter my data table in a page, in the other one the data-table is already filtered.

I tried in many ways to avoid this, creating a copy of the structure every time I access the page (Constructor, ngOnInit, a singleton copy) but this stop the data table to be sortable (the changes in my structure are not reflected in the view of the datatable).

What's the path I should take? I digged a bit and think I could use an Injector? I followed some guides and tutorial but I fear they are out of my scope or I'm in the wrong direction.

0

There are 0 best solutions below