Questions tagged [rxjs-observables]

759 questions
1
vote
0 answers

Angular - add and remove entries from an observable

Consider a table component, which holds the variable rows = Employees[]. The rows are set by a service, which I am currently trying to implement. The challenge that I am facing is that I want to be able to both add and remove rows to my table…
Luk
  • 1,009
  • 2
  • 15
  • 33
1
vote
1 answer

Failed to load resource rxjs

I just upgraded to rxjs 5.4.3 and now I am getting a error in the browser. In my package.json I have "rxjs": "5.4.3" installed so I am not sure why I am getting this error message? ts file: import { Injectable } from "@angular/core"; import {…
Jefferson
  • 173
  • 2
  • 12
  • 32
1
vote
1 answer

Property 'lift' in type 'Subject' is not assignable to the same property in base type 'Observable'

I am getting this error about property lift in the Subject.d.ts file and not sure how to correct it. I am using RxJS version 5.0.1. Error TS2416 (TS) Property 'lift' in type 'Subject' is not assignable to the same property in base type…
Jefferson
  • 173
  • 2
  • 12
  • 32
1
vote
1 answer

RxJS subcribe is deprecated

I have trouble with subcribe method. In vscode it says that subcribe is deprecated but I have no clue how to change it properly. public getAccount(): void{ this.accountService.getAccounts().subscribe( (response: Account[]) => { …
Aitsuken
  • 126
  • 10
1
vote
1 answer

rxjs retryWhen promise is resolved

I'm implementing an Angular service which calls a server for data. In every call I need to pass a token which lasts about a minute and then I need to map the response to get an specific field. So if my main call fails I need to call again for a…
1
vote
1 answer

Custom hook to subscribe to array of observables and take the latest value from each

I have an array of Observables streams$ which each emit a value once, when the associated async operation completes. I want to aggregate the results in an array arr, where arr[i] = undefined if streams$[i] hasn't completed, and the resolved value of…
user6118986
  • 341
  • 2
  • 15
1
vote
1 answer

Observable in hook dependency array causing infinite loop

I have a custom hook which receives an array of Observables as a parameter, then (in a useEffect hook) sets internal state any time the Observable emits a value. export const myHook = (obs$: Observable) => { const [state, setState] =…
user6118986
  • 341
  • 2
  • 15
1
vote
2 answers

How get initial value from an Observable Angular 8+

I have a page form with values already setted, previous and next button elements. At ngOnInit, I'm getting a List with 3 items from an observable, as initial value - sometimes I get 4 items. Before I go to the next page I have to click, necessarily,…
1
vote
1 answer

Multiple subscriptions causing source stream to fire twice

I want to use RxJS to listen to clicks, perform a transaction, and keep track of the transaction status: function performTransaction() { const status = { '0': 'pending', '1': 'success' } return interval(1000).pipe(take(2), map((i) =>…
sennett
  • 8,014
  • 9
  • 46
  • 69
1
vote
1 answer

expected behavior of immutability in rxjs observables

I've been troubleshooting a pretty nasty bug where I've eventually realized that it was caused by mutation of a nested object that was passed down the stream of observables and it really surprised me since I was thinking that Observables and their…
gil
  • 2,388
  • 1
  • 21
  • 29
1
vote
1 answer

How to load data from remote URI with nestjs/axios properly using Observables in the correct way?

NestJs suggests to use the HttpModule imported from @nestjs/axios to perform requests to external APIs. I understand that the HttpService transforms the responses into Observables. However, it makes it hard to fetch data inside of my service that…
itinance
  • 11,711
  • 7
  • 58
  • 98
1
vote
2 answers

async template bind from subscribe angular 13

I'm trying to bind data on subscribe on ngOninit, here is the page profile.component.ts below. export class ProfileComponent implements OnInit { public userDetailsArr: UserDetails[] = []; private subscriptions: Subscription[] = []; async…
namco
  • 101
  • 3
  • 13
1
vote
1 answer

Rxjs using previous observable from early stage of the chain

How do I use an observable from early stage of the chain (not the last one). I have code like this: deleteGroceryStoreAndItsOwner() { this.groceryStoreOwnerService.getGroceryStoreOwnerSummaries(this.city.uuid) …
STH
  • 73
  • 6
1
vote
1 answer

combineLatest with arrays of observables

How would one go about using combineLatest with two or more arrays of observables? const array1 = [of(1), of(2)]; const array2 = [of(3), of(4)]; combineLatest(array1, array2) .subscribe(([array1, array2]) => { console.log( `array1[0]:…
Paul
  • 45
  • 2
  • 8
1
vote
1 answer

RxJs mergeAll(), scan() coninutes to accumulate

I have this bit of code that is intended to accumulate features as they are added ot the features$$ observable. private features$$: BehaviorSubject>> = new BehaviorSubject< Observable> …
Brandon
  • 830
  • 1
  • 15
  • 35