Questions tagged angular-ngrx-data

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

Ngrx/data save additional properties

So i need to save additional properties to my ngrx store using ngrx/data. There is an answer that explains how to do it Overwriting handleSuccess of NGRX DefaultPersistenceResultHandler. However, in my case I use a custom data service, something like this getWithQuery(params: DefaultQueryParams) { return this.api.getCurrencies(true, params).pipe( map(response => response.result || []), catchError(err => { […]

ngrx/data – alternate id `has a missing or invalid entity key (id)`

As there are many IDs in the system, my entities linked to database tables and the tables use ‘DbId’ as the primary key – instead of the ngrx/data default: ‘id’. That is addressed inside the EntityMetadata map by the property: selectId. All appears working fine, except when adding records to db table. The addition to […]

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

Subscribe geting called twice for a single ngrx-data service call

I’m very new to ngrx-data and I’m try to detect why loading a few records is taking so long Here is how I subscribe to the ngrx-data entities: this.subscriptions.push(this.mileageTrackingManagmentService.entities$.subscribe(data => { console.log(‘>>subscribe mileageTrackingManagmentService – ‘ + new Date()); let tempDataset = data || []; this.calculateTotalMileageForMultipleDays(tempDataset); this.mileageTrackingManagment = tempDataset; this.filteredMileageTrackingManagement = this.mileageTrackingManagment; //this.setFilter(); //this.cdRef.detectChanges(); })); Here […]

By Mauricio Gracia Gutierrez
Published
Categorized as angular, angular-ngrx-data, ngrx Tagged , ,

How to update state with an array via NGRX reducer in Angular?

I want to update my state using a ngrx reducer but I’m getting an compilation error. For context. The user submits a worklog on a form, and I want this worklog to be added to the worklogs array on the state. Here is the structure of my state: export declare interface Outreach { outreach: CaseState|null; […]

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 […]

While implementing ngrx Observable is showing Object of unknown type

<ts.component> import { Component, Input, OnInit } from ‘@angular/core’; import { Store } from ‘@ngrx/store’; import { Observable } from ‘rxjs’; @Component({ selector: ‘app-counter-output’, templateUrl: ‘./counter-output.component.html’, styleUrls: [‘./counter-output.component.css’] }) export class CounterOutputComponent implements OnInit { counter!:number; counter$!:any; constructor(private store:Store<{counter:{counter:number}}>) { } ngOnInit(): void { this.store.select(‘counter’).subscribe((data)=>{ this.counter=data.counter; console.log(data); }); this.counter$=this.store.select(‘counter’); console.log(this.counter$); } } enter code here […]

ngrx showing "Typerror: entities.reduce is not a function" error even when `entities` contains data

I’m trying to use ngrx entity dataservice for the first time https://ngrx.io/guide/data https://ngrx.io/guide/data/entity-dataservice The API call is being made and I’m recieving the expected data But when ngrx tries to proccess it it gets an error on the reduce method I have checked other similar questions: Map and Reduce JSON Objects with JavaScript "TypeError: x […]

update function from service gets called twice every time

I have an angular application and inside of it I’ve setup ngrx data but I’ve noticed every time I call the entity service i.e this.purchaseOrderEntityService.update(updatedPurchaseOrder); it seems to run twice and hit the http endpoint twice to that effect, can’t seem to figure out why Any ideas what might be happening? Source: Angular Questions

By Corey James Carney
Published
Categorized as angular, angular-ngrx-data, ngrx Tagged , ,

Angular resolver with Ngrx data service error

I have an NGRX Data entity service that is working, I want to preload data before accessing to a route, therefore I made a resolver. import { Injectable } from "@angular/core"; import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot, } from "@angular/router"; import { Observable, race } from "rxjs"; import { filter, first, tap, mapTo } from "rxjs/operators"; […]

1 4

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