All Questions
81 questions
1
vote
2
answers
1k
views
How to wait until a value changes to true then continue running the other requests with RXJS
There is a function that must run 3 requests in a row, and it is not possible to know how many of them failed or succeeded. If the request fails, sending requests should stop and the user should click ...
1
vote
1
answer
502
views
delayUntil stop delay and emit next value if notification is closed
I need to create a toaster.
I have the Subject
this.toast$ = this.toastSubject.asObservable().pipe(
filter(toast => toast !== null),
concatMap((toast) => of(toast).pipe(delayWhen(() => ...
2
votes
2
answers
2k
views
RxJs zip operator, check which one throws an error and continue on condition?
I've 2 api service calls that I zip into one observable:
const firstAPIrequest = this.firstApi.getData();
const secondAPIrequest = this.secondApi.getData();
const combined = zip(firstAPIrequest, ...
0
votes
0
answers
219
views
Angular 12 not binding to values from webapi: returns NgFor only supports binding to Iterables such as Arrays
I've been unable to bind to a webapi call in Angular12/Typescript.
The browser displays this error:
ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only ...
0
votes
2
answers
345
views
How to lazy evaluate merged observable, i.e. on click of button when using merge() (RxJs v6)?
I have a merged stream of observables,
const nextClickHandler$ = merge(doA$, doB$, doC$),
do A$/B$/C$ are observables which makes HTTPRequests or performs some sideeffects, they operate on some ...
1
vote
4
answers
2k
views
RXJS Observables - Run a repeating function every 500ms and output results to an observable stream
First off - I'm new to Observables. Coming from Python.
I am trying to acheive:
Every 500 ms call a function to return shapes from a chart
shapes are returned in an array
I only want a filtered ...
1
vote
0
answers
719
views
RxJS switchMap operator does not cancel http request
I have been struggling to figure out why the HTTP requests are not been canceled using the switchMap operator.
import {Observable, of, Subject, Subscription, timer} from 'rxjs';
import {HttpClient} ...
0
votes
3
answers
276
views
Unable to unsubscribe while running observables in a foreach method
I am iterating an array of items via foreach method. Each item executes two http calls which are nested. I am unable to unsubscribe the observables when the loop finishes. Could you please provide an ...
0
votes
1
answer
1k
views
Angular RXJS 6: filter observable array for items matching object key
I have a service that returns an array of objects as an observable, a list of countries with objects with the country name and three-letter code,
countries$ = this.mockData.get('countries.json');
If I ...
2
votes
1
answer
2k
views
How to start observable in the pipe in RxJS 6?
I have this RxJS code in my Angular project:
settingsService.getSetting('setting-name').pipe(
map((setting: SettingInterface) => {
// ...
return setting;
}),
tap((setting: ...
0
votes
0
answers
431
views
Angular OnChange, DoCheck and Observables
Im wondering if someone could please advise.
I have data coming in through a Socket.io service to a component. Trying to decide what approach is most logical?
I can either:
A. Have the parent ...
4
votes
1
answer
6k
views
Angular NgRx Selector returns undefined
Here is my app.state.ts
export interface AppState {
getCards: Card[];
getFlippedCards: Card[];
currentPlayer: boolean;
firstPlayerScore: number;
secondPlayerScore: number;
flipped: ...
0
votes
2
answers
56
views
Angular - multiple subscribe don't get the same answer
i have a little problem, i subscribe to an observable 2 times.
On time i have the correct result but with my second subscribe, i always have the same result.
Here is my code :
import { Injectable } ...
0
votes
2
answers
88
views
merge observables don't get the value of the second observable
i have a little problem with this code :
import { Injectable } from '@angular/core';
import { BehaviorSubject, Subject, merge } from 'rxjs';
import { scan, map } from 'rxjs/operators';
import { ...
0
votes
1
answer
2k
views
Combine two observables inside pipe() chain
I'm using Rxjs, and I want to create an Observable from the following pattern (in order):
get params from paramMap$, then ...
based on the value of params, get both (getData():Observable, ...