Questions tagged ngrx

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

I cannot Register my reducer in app.module for ngrx

I’m new to ngrx and am trying to follow a couple of examples. I’m using Angular 13 with ngrx 13.0.1. I’ve declared my reducer as follows: import { Action, State } from ‘@ngrx/store’; import { Swivlr } from ‘../../Models/swivlr.model’; import * as SwivlrActions from ‘./../Actions/swivlr.actions’; export const initialState: Swivlr = { key: ‘1’, name: ‘Swivlr’, […]

By bilpor
Categorized as angular, ngrx Tagged ,

how to creat 1 empty line of table using formcontrol

I need to creat an empty table with one line – including 3 inputs of formcontrol that I have on treesSummary: .ts cols = [ { field: ‘quantityOfRequest’, header: ‘סה"כ בבקשה’ }, { field: ‘unprootSum’, header: ‘לכריתה’ }, { field: ‘copyingSum’, header: ‘להעתקה’ }, { field: ‘conservationSum’, header: ‘לשימור’ } ]; this.fg ={ treesSummary: […]

By Yoel Perkal
Categorized as angular, javascript, ngrx, primeng Tagged , , ,

Ngrx Store as dependency in providers causes cyclic dependency

I’m trying to override default angular ErrorHandler by providing factory function which should have ngrx store injected: import { ErrorHandler } from "@angular/core"; […] { provide: ErrorHandler, useFactory: (store: Store<AppState>) => { return Sentry.createErrorHandler({ showDialog: true, dialogOptions: {}, }); }, deps: [Store], }, but I get cyclic dependency error: main.ts:42 Error: NG0200: Circular dependency in […]

By Memke
Categorized as angular, ngrx Tagged ,

Generic @ngrx/data service extending EntityCollectionServiceBase

Is it a viable option to implement a generic @ngrx/data service, such as: import { Injectable } from ‘@angular/core’; import { EntityCollectionServiceBase, EntityCollectionServiceElementsFactory } from ‘@ngrx/data’; @Injectable({providedIn: ‘root’}) export class NgRxDataService<T> extends EntityCollectionServiceBase<T> { constructor(entityName: string, serviceElementsFactory: EntityCollectionServiceElementsFactory) { super(entityName, serviceElementsFactory); } } … and use it with multiple pre-set data type objects / entities […]

By Felix
Categorized as angular, ngrx, ngrx-data Tagged , ,

NGRX effect does not see the full state as it is in the store

I have a form that is divided in several sub-forms, each has its own submit button that dispatches an action, that calls my reducer. My the formdata in the store looks like this (example) myData { propA1?: string, propA2?: string, propB1?: string, propB1?: string, } and my reducer looks like this const myDataReducer = createReducer( […]

By Michiel
Categorized as angular, ngrx, ngrx-effects, ngrx-store Tagged , , ,

[Bug]: Cannot find module ‘@ngrx/effects/testing’ after version updates

I migrated the project from version 25 to 27 and the module ‘@ngrx/effects/testing’ cannot more found. In my case the baseUrl in the project set to ‘./src’.In other projects with baseUrl ‘.’ and with the same jest, angular, ngrx the tests run without problems. Maybe some additional configuration for jest required? This the message I […]

By Anastasia Osintseva
Categorized as angular, jestjs, ngrx Tagged , ,

Angular NgRx type problem on ActionReducerMap

I’m coding a small Angular app to learn NgRx but I got stuck on configuring the reducers, I think that the problem is related to the Angular strict mode but I didn’t find any info about it. I’m using the following setup: Angular 13 NgRx 13 Node 16 common.actions.ts import {createAction} from ‘@ngrx/store’; export const […]

By Rene Nochebuena
Categorized as angular, ngrx, ngrx-store, typescript Tagged , , ,

NgRx how to extend EntityState and EntityAdapter

I want to extend EntityState interface to also contain a cache prop and methods of EntityAdapter to manipulate this cache. I faced the problem that I can’t easily ‘patch’ methods of EntityAdapter. Ideally I want to call method createCachedEntityAdapter and it should return a type whos methods like setAll expecnt and return my updated ‘cached’ […]

By simply good
Categorized as angular, ngrx, typescript Tagged , ,

Simple NGRX Data Nested Object Management

I’m using NGRX/Data for managing state. Let’s say I have a model of a course, and inside a nested array of lessons. The API gives me a nested array of the course and inside it the lessons, but a different POST method for adding a lesson. I understand that NGRX doesn’t work with nested objects. […]

bind variables from store to component in angular ngrx

I’m trying to bind the location variable in the component to another variable in the store via selector with ngrx v13 in angular, but when I put the variable with the property in the HTML I get an error: error message: Property ‘name’ does not exist on type ‘Observable’ that is my code: app.selector.ts import […]

1 2 3 85

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