Questions tagged [ngrx-store-4.0]
116 questions
57
votes
4 answers
What is the difference between StoreModule.forRoot() and StoreModule.forFeature()
Recently ngrx store changed the way to register the store variables in an angular application.
What is the difference between StoreModule.forRoot() and StoreModule.forFeature()
Do we need to register both to make the application work?

Shanmugam M
- 721
- 1
- 5
- 10
34
votes
2 answers
NullInjectorError: No provider for ReducerManager
I am using the new ngrx 5. This is the file that holds the reducers and the featureSelector:
import AppState from '../interfaces/app.state'
import { ActionReducerMap, createFeatureSelector } from '@ngrx/store'
import { partnerReducer } from…

suku
- 10,507
- 16
- 75
- 120
31
votes
3 answers
what is ngrx createSelector and createFeatureSelector?
I have been reading the code of ngrx example app and find two function calls
createFeatureSelector('auth');
and
createSelector(selectAuthState,(state: AuthState) => state.status);
What does this do?
export const selectAuthState =…

Karty
- 1,329
- 6
- 21
- 32
19
votes
3 answers
@ngrx/store combine multiple reducers from feature module
I am currently working on a simple test app to learn more about the @ngrx/store. I have a module called TrainingModule which should store some exercises and more information.
The code works, but i try to improve here. What i currently have is my…

jhen
- 1,164
- 1
- 11
- 24
18
votes
3 answers
Property 'take' does not exist on type 'Store' ngrx/store
I'm trying to use the property 'take' when selecting a state in my feature but I'm getting the error Property 'take' does not exist on type 'Store. Please, anyone has a clue of what is going on? The reason I want to do that is because I have…

Wagner D'Amaral
- 227
- 1
- 2
- 9
14
votes
2 answers
Using the constructor in order to select on the store and ngOnInit in order to dispatch from the store
My question relates to dispatching & selecting from the ngrx store.
Let's look at the following code from the official example app:
export class CollectionPageComponent implements OnInit {
books$: Observable;
constructor(private store:…

balteo
- 23,602
- 63
- 219
- 412
12
votes
3 answers
Angular ngrx-store: How to share store among modules (main module / feature module)
I have two angular modules: main and feature:
Main / root module:
@NgModule({
imports: [
StoreModule.forRoot({router: routerReducer}),
EffectsModule.forRoot([...]),
...
],
declarations: [],
...
})
export class…

Felix
- 3,999
- 3
- 42
- 66
11
votes
3 answers
How to wait for dispatch to be completed before selecting from a store. Ngrx related issue
How can I wait for a dispatch to be completed before I select from a store. Do not have any luck in Googling? In this case, how do I wait for the dispatch to be done first before selecting from store?
My codes, appreciate the help…

Sian20R
- 113
- 1
- 1
- 7
10
votes
2 answers
Accessing state in an NGRX effect
How can I access a piece of my state inside an effect? My current effect implementation (shown below) is triggered when a SEARCH_REUQUEST action is dispatched. However, I would like to access a piece of state to fetch some search parameters before…

cyberbeast
- 678
- 1
- 12
- 30
10
votes
2 answers
How to get route params inside ngrx effects using ngrx-router-store?
I am having effect class where I want to load details based on router params ID
@Effect()
getDetails$ = this.actions$.ofType(DetailActions.GET_DETAILS).pipe(
map(toPayload),
switchMap(payload => {
return this.detailService
…

Borad Akash
- 754
- 1
- 8
- 21
9
votes
3 answers
Error: No Provider for Store! in @ngrx 4.x
When migrating my project from @ngrx 2.x to 4.1.0, I encountered the error message
NullInjectorError: No provider for Store!
The store was imported as shown in the docs:
import { StoreModule as NgRxStoreModule } from '@ngrx/store';
@NgModule({
…

Anton Poznyakovskiy
- 2,109
- 1
- 20
- 38
9
votes
2 answers
ngrx store 4 select not working
I was struggling the whole day to get my Angular app working with ngrx/store 4. After lots of unsuccessful hours, I decided to create a new absolute minimal app to check if I have maybe another problem. But the minimal app is not working at all…

Josef Bauer
- 199
- 1
- 1
- 13
8
votes
2 answers
ngrx payload in reducer action not compiling
I am trying to migrate my angular 2 app to angular 4 and ngrx 4.
I am tackling a weird typescript compilation problem that I didn't have before this update. I work in an off line environment, so I cant share the exact code here.
I looked for the…

Ziv Glazer
- 786
- 2
- 8
- 24
7
votes
4 answers
Providing root reducer in @ngrx/store 4.0
In @ngrx/store 2.0 we could provide the root reducer as a function and from there we split our logic inside the application. After I updated to @ngrx/store 4.0 I cannot use this feature any more from what I can see the reducers need to be a map of…

Nicu
- 3,476
- 4
- 23
- 43
6
votes
2 answers
How to get previous state from Router_Cancel in ngrx?
I was trying to restrict the user from navigating away from the current page by using CanDeactivate (if form is dirty and not saved). By the time we click on any link, Router_Navigation event is getting called and it is updating the router state in…

kumar
- 248
- 3
- 12