-
Notifications
You must be signed in to change notification settings - Fork 406
Open
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[x] Support request => https://github.com/ngxs/store/blob/master/CONTRIBUTING.md
[ ] Other... Please describe:
Current behavior
How to do per component store instance? Is it even possible?
Imagine that you built some large scale, drawing app using ngxs all works great and fast. Some day your boss tells you that he want's to compare drawing so you decide (more or less) to duplicate your main board.component.ts, it still has to use ngxs - you dont want to rewrite whole app but each instance of BoardComponent should have own instance of the stores, own data.
Ideally what I need to achive is to have 3 store instances:
- root, being accessible by all components
- board 1 store: only accessible by component and it's children
- board 2 store: only accessible by component and it's children
Board 1 & Board 2 have to be exactly the same stores, with the same states, actions but different data.
Is it possible to create store per component like creating services in angular per instance?
@Component({`
selector: 'board',
providers: [
CommentsService, // this is completely new instance and does not share any data with other board components,
]
})
Environment
Libs:
- @angular/core version: 7.2.11
- @ngxs/store version: 3.4.3
Reactions are currently unavailable