Questions tagged [rxjs-observables]
759 questions
1
vote
2 answers
Observable in ngIf directive
I have a method that returns roles of a user like:
getUserRoles() : Observable {
return this.getToken().pipe(
map(token => {
let payload = decode(token);
return payload["roles"];
})
)
}
I'm trying…

kovac
- 4,945
- 9
- 47
- 90
1
vote
1 answer
Angular Reactive Form - FormArray ChangeDection onPush not working
We are using ChangeDetectionStrategy Onpush in all the components, so we are following dump/smart component approach, so we are keeping all the logical part in service/facade side.
Right now we need to generate dynamic controls using Reactive Forms,…

Cegone
- 489
- 1
- 9
- 23
1
vote
0 answers
Why do Angular 9 http calls take longer compared to Postman?
My app is integrated with ASP.NET MVC and works with a cookie-based authentication.
At first, I run a config method to get the basic user ID & culture that needs to pass in subsequent calls, using APP_INITIALIZER, this resolved in 72 ms:
This…

foo-baar
- 1,076
- 3
- 17
- 42
1
vote
1 answer
Why my Angular/Rxjs6.5 shareReplay(1) not working?
I have very simple code in my service class:
userContext$ = this.http.post(this.userContextService, {}).pipe(
shareReplay(1),
tap((val: UserContext) => (this.userContext = val))
);
This is called twice, first in Header and…

foo-baar
- 1,076
- 3
- 17
- 42
1
vote
1 answer
Why is my redux-observable epic not being triggered?
trying to understand rxjs and rxjs within redux and redux observables by trying to do a simple fetch example
got my store set up like so:
import { applyMiddleware, createStore } from 'redux'
import { reducers } from 'redux/reducers'
import {…

Red Baron
- 7,181
- 10
- 39
- 86
1
vote
1 answer
why map with condition return always value
I'm using rxjs map to retrive data in firestore like this:
getArtists(): Observable {
const users$ = this.firestore.collection('/Users').get()
users$.subscribe((users) => {
users.docs.map(user => user.data().artistName…

Alexis Lapeze
- 69
- 2
- 10
1
vote
5 answers
How to remove the redundant requests in RXJS?
I am working on a front-end project with Rxjs and Angular Framework and I want to get json data from a api "api/data_processor_classlib.php....". There are three parts was subscribed the pipe this.webProtectionHTML$ at HTML. I don't know why the…

Di Wang
- 43
- 8
1
vote
1 answer
How do I get my observable to have it's values for use in an NGRX effect
To be honest I am a total noob at NGRX and only limited experience in rxjs. But essentially I have code similar to this:
@Effect()
applyFilters =…

djangojazz
- 14,131
- 10
- 56
- 94
1
vote
1 answer
Subscribe not firing error when the server response with 400 http error
I'm totally clueless about why error is not firing
this is the code where I call the server
this.userService.createUser(values).subscribe((response)=> {
this.alertService.showConfirm("Usuario creado");
…

JoseCarlosPB
- 933
- 2
- 14
- 29
1
vote
1 answer
Observable.subscribe() not working in IE on component change in Angular 7
I have two HTML buttons 'previous' and 'next'. I have different tabs (components) to which I navigate to using these buttons. The code works as expected in Chrome and Firefox but it gives a blank screen when clicking next and previous buttons in IE…

urbaneye
- 11
- 1
- 4
1
vote
1 answer
Why operators (tap, map) are not called on inner observable, when using combineLatest?
Why are operators tap and map of inner observable not called? combineLatest should subscribe to observables it gets in obsArr, right? Why this subscription does not trigger those operators?
const obsArr = [];
[[1, 2], [3, 4], [5, 6]].map(arr => {
…

mimo
- 6,221
- 7
- 42
- 50
1
vote
1 answer
How to update sum from dynamically created inputs?
I have multiple inputs that are created dynamically (Can add or delete inputs). and a text field that shows the sum of the inputs. How can I attach observable dynamically and how can my text subscribe to all of them?
Since I am not able to figure…

Delfin
- 607
- 7
- 18
1
vote
2 answers
Twin subscribes block forkJoin subscription
Here is the test, in the ngInit of any angular component:
console.log('a');
observableFoo$.subscribe(x => console.log('b'));
observableNotFoo$.subscribe(() => console.log('c'));
forkJoin([
observableFoo$,
observableNotFoo$
]).subscribe(([foo,…

Ashijo
- 90
- 8
1
vote
2 answers
execute multiple requests angular 8
I am new to rxjs operators
What is the most efficient way to execute two requests and check if one of the requests comes back as valid and also check if both failed.
I tried forkJoin but unable to determine how to when both requests failed.

Immortal
- 1,233
- 4
- 20
- 47
1
vote
1 answer
Spying on Observable subscribe() and add() method in Angular unit test
I have a method in my testComponent that returns an observable which is been subscribed to and after been unsubscribe from, then it runs the code in the .add() (i.e when the subscription is been unsubscribed from)
How do i spy on this method and…

Johnniexson
- 51
- 2
- 8