1,510 questions
0
votes
2
answers
60
views
Angular 16 RxJs Issue Updating Total on Header Component
Hello I have an question regarding my Observable.
I have a cart as well as checkout that works fine when I add a another items to cart
it handles total items as well as total cost. These components ...
2
votes
1
answer
100
views
Why does RXJS Observable stops emitting after getting error
I am trying to access datas every time the user changes the input value.
The search can return an error.
In this case, I want to disable the use of AI (semanticDisabled) for future searchs and then ...
0
votes
1
answer
75
views
Timeout stops stream rxjs Angular
Hi i want to keep getting data even after the timeout its reached i try some other way but no success (timeWith, repeatWhen ect)
here my code. now, any help would be good
goal: Device stops sending ...
0
votes
0
answers
33
views
Shield observable chain
I have this RxJS observable chain. I want to remove final error handling (since there is some error handling in chain which I need there) from chain and leave it to Global error handler. Whatever I ...
0
votes
1
answer
36
views
rxjs 5 -> 6 migration: connect operator missing
We started upgrading rxjs from v5 to v6 (without using the compatibility layer, in case it makes any difference).
The majority of the changes are straight forward and well documented in https://github....
0
votes
0
answers
205
views
Angular module's provider service is acting as singleton even though that module is imported in other feature modules
As per angular document - https://angular.io/guide/singleton-services
If a module defines both providers and declarations (components, directives, pipes), then loading the module in multiple feature ...
0
votes
1
answer
78
views
How to take some of the properties of an Observable and assign them to another Observable using RxJS operators
I have an employee$ Observable and a personalInformation$ Observable. personalInformation$ is a subset of employee$ and I want to map the matching properties of employee$ to personalInformation$. The ...
1
vote
0
answers
72
views
How to make my newly created observable subscribers to get a boolean?
I want to make an observable that when a subscribed to emits a boolean , i tried a lot of combinations but nothing seems to work.
example:
let myObservable = new Observable<boolean>(item => ...
1
vote
1
answer
1k
views
How to import firstValueFrom function from rxjs in Angular 13?
Module '"rxjs"' has no exported member 'firstValueFrom'.ts(2305)
0
votes
2
answers
3k
views
How do I combine two subscriptions in Angular?
Is there a way to combine the subscriptions for this.controls.attendanceDate and this.controls.type? I need to have access to both at the same time in order to call each of this....
0
votes
2
answers
137
views
RxJS operator equivalent of ((observableX | async) || (observableY | async)) in template
I have the following code in my component template
<mat-spinner *ngIf="((facade.user.data$.isLoading | async) || (facade.product.data$.isLoading | async))"></mat-spinner>
I want ...
-1
votes
1
answer
542
views
Call a method from inside of subscribe
Im trying to call a method from inside of subscribe in angular/ionic. But its not working. Here is my code:
somemethod()
{
const browser = this.iab.create('https://someurl.com');
browser.on('...
1
vote
1
answer
2k
views
Angular: intercept an HttpResponse and make other calls before propagate the response to caller
What i'm trying to do is to intercept a response and if here is a certain value (CHALLENGE), make a call to an other API and retry it 3 times if needed, then, if success, reply the first call and ...
0
votes
0
answers
435
views
Subject import package difference
I got a warning when I serve my Angular app.
depends on 'rxjs/internal/Subject'. CommonJS or AMD dependencies can cause optimization bailouts.
But when I changed Subject import package.The warning ...
0
votes
2
answers
1k
views
how to flatten the nested array in rxjs
I am using forkJoin to subscribe multiple inner observable. How can I flat nested array to single level array.
const x$ = of([1, 2, 3, 4]);
const y$ = of([2, 4]);
x$.pipe(
switchMap((t) => {
...
1
vote
1
answer
1k
views
Map behavioursubject and assign it to same variable after mapping rxjs
I have a scenario, my child component takes BehaviourSubject as Input and that(child) subscribes it internally.
I need to filter/map on BehaviourSubject in the parent, so that when somewhere next() is ...
-1
votes
1
answer
49
views
How to get data from second stream by first?
I have tried to get data from BehSubject this.visible$ only in case when this.redraw$ happends.
It works, but if the this.visible$ is changed somewhere the prev stream again works. How to avoid it?
...
0
votes
1
answer
569
views
Swicthmap in rxjs doesnt cancel the previous request
I am basically calling an API on keyup event of a textbox using switchmap. The problem that I am facing is that switchmap doesn't cancel the previous ongoing API call when a new API call is made
...
0
votes
1
answer
456
views
How can I make an Alert appear in the screen using AG Grid and Adaptable/
I created an Observable Alert in AG Grid (using Adaptable) which is correctly firing when an order is stale for 2 minutes.
But I only see the Alert in the Toolbar and not as a popup notification in ...
1
vote
1
answer
203
views
What's the added value of using Observable over normal Array? [closed]
I've been using Observables in Angular in the state layer to store the app data and to share that data among the components of the app. With a belief, using observables, that data would passively ...
0
votes
1
answer
872
views
Avoiding duplicate calls inside keyup event in angular
What i am trying to do is
call a service and bind the data on ngOnit()
In the given textbox, when a user types something, instead of calling API call for every letter, wait for a second, if user ...
1
vote
1
answer
576
views
debounce request on button click with angular
I'm finding it hard to implement debounce on an HTTP request with Rxjs once a button is clicked. What I'm trying to achieve is when the button is click, it should wait for x seconds before the post is ...
0
votes
1
answer
45
views
Angular data not loading
Angular also goes into the "first" place when I get data from the service. However, without clicking any button on the page, it does not enter the place where I write "second".
...
1
vote
1
answer
434
views
How to put custom gap between interval for polling in Rxjs angular?
I would like to implement gap / delay between every interval call,
i have tried below but it seems not working.
pollOnInterval(threshold = 4000): Observable<any> {
let thresholdValue = ...
0
votes
2
answers
36
views
How can i combine my RXJS expressions that represents two different logic?
Hi I am having an angular2 project.
I have two rxjs expressions. how can i combine both of them . the following is my rxjs expressions.
this.trafficTypeControl.valueChanges
.pipe(
filter(...
0
votes
1
answer
95
views
Issue with asynchronous angular requests
How to handle asynchronous calls in angular. I know i am getting array as undefined due to asynchronous nature but how do i solve it
private fetchData(id){
var array = [];
this.httpClient.get('...
1
vote
2
answers
969
views
RxJS group by field and return new observable
I've following interfaces and Observable<Machine[]>, what I want to achive is group by Machine symbol property in Observable<Machine[]> and return mapped observable Observable<Order[]&...
0
votes
1
answer
137
views
BehaviorSubject not working as expected Angular
I am trying to pass an email from accountrecovery component to password-reset component with BehaviorSubject but Im not receiving the email in password-reset component instead I get the initial value. ...
0
votes
1
answer
130
views
Abort promise chain upon action dispatch (rxjs)
Here is what I want to achieve:
this.jobManager
.queue(
// start a job
)
.then(
// do more stuff, but abort if `ABORT` action dispatched before it finishes
)
....
1
vote
1
answer
603
views
Cancel repeated subscription in mergeMap
How to combine the distinct, switchMap and mergeMap operators, so that when the source emits repeated values (detected by distinct.keySelector), the previous subscription is canceled (as in the ...
1
vote
1
answer
7k
views
Subscribe to one observable twice from a component doesn't work
I got several components subscribing to my data service and they are all working fine. But in one of my components, I try to subscribe twice (inside ngOnInit and ngAfterViewInit) but this doesn't work....
1
vote
2
answers
1k
views
RxJS - How to incrementally increase the delay time without using interval?
I want to incrementally increase the delay for this:
const source = from(839283, 1123123, 63527, 4412454); // note: this is random
const spread = source.pipe(concatMap(value => of(value).pipe(delay(...
1
vote
1
answer
170
views
How to concat multiple array observables that some might not emit any stream
Let's say I have following situation:
allItems$: <(TypeA | TypeB)[]>;
arr1$: TypeA[]; // [{a: 1, b: 2}, {a: 3, b: 4}]
arr2$: TypeA[];
arr3$: TypeB[]; // [{ b:1, c: 2}, { b:3, c: 4}]
arr4$: TypeB[...
0
votes
2
answers
779
views
subscribing when mouseover on particular element in the DOM
I need to subscribe & do some actions, when mouseover on particular elements in the DOM.
For Example: home.component.html
<div class="container">
<div ...
1
vote
1
answer
163
views
RxJs 5 of.filter.mapTo operators -> RxJs 6
I've inherited some old RxJs 5 code that smells awkward:
myFunc = (tag: TagModel): Observable<TagModel> => {
try {
const foundTag = this.mappedTags.find((x) => {
return ...
0
votes
1
answer
248
views
rxjs : get duplicate http requests on the first set that I send
I made this functionality, each iteration i have 7 requests that sent each environment.dashboard.frequency time,
but at the beginning, I see that i send 14 requests to the server instead of 7 :
let ...
2
votes
1
answer
371
views
undefined output while using mergeMap in Rxjs
Theoretically, I know what mergeMap is and how it works, but when I try to understand using
practical approach I get confused, this is what I have done so far
const input1$= of("value 1",&...
0
votes
0
answers
23
views
Using RXJS 5 for Paginating a Search [duplicate]
I'm trying to paginate a search and I need to prevent it from concatenating the list of results from the previous search.
Ex Search: %Dog%
1st page of results:
"Dog Barks", "Dog Growls&...
0
votes
2
answers
2k
views
How do I map a list of objects from an HTTP API to a list of strings? [closed]
I am trying to use the merge operator is given below. I want to put only 'Mr' before login but I am getting an error, your help is much appreciated, thank you
let data=this.http.get('https://api....
0
votes
0
answers
169
views
RXJS Share state between merge streams
I need to make API call for get/set method. But these Service need previous state to make a next call.
In this pattern, in state prop I wanted to maintain previous state of this stream so that when I ...
0
votes
2
answers
284
views
How to smooth stream Rxjs?
I have a Rxjs:
private loading = new BehaviorSubject(false);
The loading can be changed fast from true to false. How to smooth this stream and pass values only if time between false and true is ...
0
votes
1
answer
272
views
spyOn(Observable, 'fromEvent') throws error after upgrading to rxjs 6.5
getInactiveTimerTabSynchronizer() {
return fromEvent(window, 'storage').pipe(
filter((x: StorageEvent) => {
return x.key === this.inactivityTabSynchronizerStorageKey;
}),
...
-1
votes
1
answer
30
views
How to improve Rxjs statement?
I have the following Rxjs statement:
const versionsRequest2$ = (num: string) =>
request2$(num).pipe(
map((versions) => {
const p = new P();
...
-1
votes
1
answer
189
views
How to send requests to server one after one RxJS?
How to correctly send RxJS requests, when there are 4 different API endpoints, I need to request each endpoint until previous does not return data.
Schema is:
Request 1 -> Return Void
Request 2 -&...
-1
votes
1
answer
36
views
How to call forkJoin in switchOperator?
I have tried to call forkJoin in switchMap:
this.route.params.pipe(
pluck('cadnum'),
tap((cadnum) => {
this.r1.repositoryModel.findallversionbycadnum.model.cadnum = cadnum;
this.r2....
2
votes
1
answer
703
views
complicated pipe chain with the HttpClient in Angular with RxJS
I dont have a lot experience in RxJS and I want to do the following thing with a RxJS pipe in my Angular service.
I tried with the iif function but I simply have not enough experience in it.
Angular ...
0
votes
1
answer
252
views
Creating multiple async pipes of unknown number
I am using Angular 5 and loading a list of items using a selector with my NGRX library. My selector returs a list of items which I used to dynamically create tabs on a page using the async pipe. Now, ...
1
vote
1
answer
118
views
Managing subscriptions based on async event
Im looking a way to simplify this and avoid managing subscriptions inside my pipe.
The general idea abought my code:
this.start$ubject // waiting for users call to start
.pipe(
mergeMap(() =&...
5
votes
1
answer
2k
views
How to test with the marble approach when the returm is a EMPTY observable in effect?
I am using EMPTY from rxjs in order to handle the catchError, What is the correct value for expected in order to pass the fail scenario.
import { Injectable } from '@angular/core';
import { Actions, ...
1
vote
2
answers
232
views
How to use TypeScript in RxJs (BehaviourSubject) for strict type checking?
I am trying to create a BehaviourSubject using RxJs. Here in this code
import { BehaviourSubject } from 'rxjs';
const name = new BehaviourSubject("Dog");
// Here in the subscribe callback, I am ...