Questions tagged [rxjs-observables]
759 questions
0
votes
2 answers
How to sum inner property of nested observable arrays, using Angular/RXJS?
I am having trouble getting the sum (or any reduction) of an inner number property of an Observable within another Observable.
I have an Observable array of "Account" objects (Observable).
export interface AppAccount {
_id?:…

Jonathon Hoaglin
- 119
- 1
- 12
0
votes
1 answer
Angular / RXJS - How to perform logic after a switchMap
In one of my components I have a function that updates a local observable (album$) which is then used in my html to display the data (*ngIf="album$ | async as album"). This works perfectly fine.
getData() {
this.album$ =…

Haven
- 87
- 1
- 9
0
votes
2 answers
RxJS shareReplay() does not emit updated value
I have a user service which allows login, logout and maintains data about the currently logged in user:
user$ = this.http.get('/api/user')
.pipe(
shareReplay(1),
);
I am using shareReplay(1) because I do…

funkycoder
- 525
- 4
- 17
0
votes
2 answers
Issue in Observable vs Promised-based Approach
In my Ionic/Angular app I am converting some promised-based implementations to use observables instead. I am running into one issue with a particular function. My original (working, promised-based) code looked like this:
async getPlayerStats() {
…

Rey
- 1,393
- 1
- 15
- 24
0
votes
0 answers
Best way to subscribe RxJS observable in React.js
I am using RxJs to create data stream observable. It sends 400 entries after some interval.
I am subscribing to it in other react component,
constructor(props) {
super(props);
this.state = {data : []};
}
componentDidMount()…

Mangesh Tak
- 346
- 1
- 6
- 22
0
votes
1 answer
Reading parameter and then finding single element in Angular
I have a service carriersService with method getAll(), which returns an Observable.
In my component, I'm trying to read route parameter carrierId, find the carrier with such carrierId and assign it to a local variable
let carrier =…

Alex Dantsev
- 31
- 3
0
votes
1 answer
Accessing value in an Array
I've been working on a simple test project, but i happened to come across this really weird problem. I can't access values in an array.
pokemonStats$: Observable;
getPokemonStats(id: number): any…

Tomas Loksa
- 95
- 1
- 10
0
votes
3 answers
Nested observables where response from first observable is passed to the second and both responses are used in the final subscription
What is the correct way to write this without using a nested subscription?
The first observable will return a value that is passed to the second observable, then I need to use the returned values from both observables in the final…

WebFletch
- 172
- 1
- 16
0
votes
2 answers
Nested observables where final API call needs to use result from both observables
I have the following code where I need to get a value from two separate observables (they are actually promises but have been converted to observables using "from") and then use the values returned from each to make a final API call where both the…

WebFletch
- 172
- 1
- 16
0
votes
2 answers
How to re-execute async observable on parameter change?
I have a simple async observable which takes 2 parameters to perform some calculations:
public preferredCurrency: string = '';
wmData$ = this.http.get("./api/wealthModeling/GetWMData");
portfolioCalculation$ = this.wmData$.pipe(
…

foo-baar
- 1,076
- 3
- 17
- 42
0
votes
2 answers
Reinitializing an Observable object
I would like to have the ability to reinitialize an Observable object.
I don't know if "reinitialize" is the corrent term, but what I mean by that is that I would like to refresh the data
without creating a new Observable object, and
without…

yellowtail
- 435
- 3
- 12
0
votes
1 answer
Cannot Pass output from Retrofit enqueue to MainActivity Kotlin
I am calling the API using retrofit in ApiClient Class. Where I am trying to store the output of successful login either message or responseBody into the output string. I tried using the output string as part of ViewModel Observer type too
But I…

Ashish Vashisht
- 31
- 1
- 8
0
votes
0 answers
subscribing to observable returned from ngrx's Entity Collection Service not returning proper result
i created a service by driving my service from
EntityCollectionServiceBase
My entity is called Transaction.
i am overriding the getAll method like this
getAll(): Observable {
return this.http
…

Raas Masood
- 1,475
- 3
- 23
- 61
0
votes
3 answers
RXJS Angular - Error handling using .subscribe and Observable
I have a backend api to create new product. The frontend angular code needs to call a backend API. How to carry out error handling using ** .subscribe**. I'm using HTTPClient and using Observable and been reading about how RXJS utilizes error…

StarJedi
- 1,410
- 3
- 21
- 34
0
votes
1 answer
Merging an Observable and Promise to an Object
How do I merge two function returns (one returns a promise, one returns a object) from an Observables?
How do I chain the results? What is the proper way to do this?
functionReturnObservable(
element: SomeInterface,
):…

hammies
- 1,344
- 2
- 22
- 46