Questions tagged ngrx-store

Explore the latest questions and answers asked by our top developers.

Nested actions on ngrx/effects not diplaed on template

Im having 2 API. Both of them start as soon as page load. One of them API_1 take a params from API_2. Im able to get logs from Effects but on .ts got undefined. Have created actions and selectors for both API. For first API are 3 actions : load, loadSucess, loadFailure. While for second […]

Angular is giving State’ is not assignable to type ‘ActionReducer<State, Action>’ error

Above error is thrown by VSCode IDE, while trying to combine reducers in one file. import { ActionReducerMap } from ‘@ngrx/store’; import { employeeReducer, State } from ‘./store/reducers/employee.reducer’; export interface AppState { employee: State; } export const appReducer: ActionReducerMap<AppState> = { employee: employeeReducer, // Getting IDE error here }; My action looks like import { […]

By Rajath
Published
Categorized as angular, angular13, ngrx-reducers, ngrx-store Tagged , , ,

NgRx Data service Update removes object prototype instead of updating the changed fields

When my NgRx DefaultDataService updates, it removes the type/prototype of the objects in the store. The objects are no longer of type Todo, but are simple objects with no prototype. The objects come from the server as json objects conforming to the Todo interface. I pipe them to be entered into the store as Todo […]

By RedAlex
Published
Categorized as angular, javascript, ngrx, ngrx-entity, ngrx-store Tagged , , , ,

Why ‘subscribe’ doesn’t trigger when chain pipe with ‘select’ from NgRx in Angular

I have two examples of code, and I can’t understand why second example is not working. For me they are equivalent. First example is working: this.someValue$ = this.store.pipe( select(someValue), takeUntil(this.ngUnsubscribe$$) ); this.someValue$.subscribe(someValue => this.someValue= someValue) And second example is not working when the store has changes, it triggers only once: this.store.pipe( select(someValue), takeUntil(this.ngUnsubscribe$$) ).subscribe(someValue => […]

By Experimenter
Published
Categorized as angular, ngrx, ngrx-store, ngrx-store-4.0 Tagged , , ,

Store FormGroup in @ngrx/store

In an Angular application I have a page with multiple tabs (using ngx-bootstrap). Each tab contains a FormGroup and multiple FormControls. I would like to persist the whole FormGroup in a @ngrx/store rather than its value, as my goals is to restore also the controls’ state (disabled, required, etc.) when navigating back to the same […]

By Francesco
Published
Categorized as angular, formgroups, ngrx-entity, ngrx-store Tagged , , ,

NGRX router-store: selectCurrentRoute selector undefined

I’m trying to use the selectCurrentRoute selector, but I only get undefined. export interface AppState { routerState: RouterReducerState<RouterStateUrl> } export const reducers: ActionReducerMap<AppState> = { routerState: routerReducer }; export const selectRouterState = createFeatureSelector<RouterReducerState<RouterStateUrl>>(‘routerState’); export const { selectCurrentRoute } = getSelectors(selectRouterState); export const getCurrentRoute = createSelector(selectRouterState, selectCurrentRoute); —— this.store .select(routerFromSelector.getCurrentRoute) .subscribe((route) => console.log(route)); core.module.ts StoreModule.forRoot(reducers), StoreRouterConnectingModule.forRoot({ […]

By Max
Published
Categorized as angular, angular-routing, ngrx, ngrx-store Tagged , , ,

Ngrx: How to simplify the definition of actions?

Is there any way to simplify the definition of actions so that we don’t need to repeat code over and over again? Working with Ngrx we have to work with actions all the time. In my situation, the most time each action does have a "Do"-Action, a "Success"-Action and a "Failure"-Action. In my situation each […]

By julianpoemp
Published
Categorized as angular, ngrx, ngrx-store, typescript Tagged , , ,

Store<AppState> undefined within angular spec file

Issue: store is undefined within angular spec file no matter whether the initial state is provided or not. As a whole, I am not entirely sure what could be causing this issue. Followed the NGRX testing documentation to implement mock store. store variable should at least be defined to show an empty object if anything […]

"Cannot freeze" when adding web3 to ngrx state

core.mjs:6469 ERROR TypeError: Cannot freeze at Function.freeze (<anonymous>) at freeze (ngrx-store.mjs:824) at ngrx-store.mjs:838 at Array.forEach (<anonymous>) at freeze (ngrx-store.mjs:826) at ngrx-store.mjs:838 at Array.forEach (<anonymous>) at freeze (ngrx-store.mjs:826) at ngrx-store.mjs:838 at Array.forEach (<anonymous>) core.mjs:6469 ERROR TypeError: Cannot read properties of undefined (reading ‘vaults’) at vaultState (vault.selectors.ts:6) at ngrx-store.mjs:600 at Array.map (<anonymous>) at defaultStateFn (ngrx-store.mjs:600) at ngrx-store.mjs:700 […]

By Darthg8r
Published
Categorized as angular, ngrx-store, web3, web3js Tagged , , ,

MemoizedSelector is not assignable

I’m trying to get ngrx/store up and running in a new Angular app. I’m trying to follow the pattern of having an effect do the http fetching. The idea is to dispatch FetchVaults, have effect fetch data from server, and then it dispatches a success action that populates state. The compile error that’s occuring is: […]

By Darthg8r
Published
Categorized as angular, ngrx-effects, ngrx-store, typescript Tagged , , ,
1 22

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq