Questions tagged [rxjs6]

RxJS6 is version 6 of Reactive Extensions for JavaScript, with some added changes in websocket, testing and bug fixes.

1219 questions
17
votes
3 answers

How does throttleTime operator's config parameter work? (ThrottleConfig)

I have read the throttleTime documentation, but I don't get the operator fully. I know how throttleTime(1000) works. After an event arrives it will skip all subsequent events for 1 second and then start this process again. What I have trouble to…
Goga Koreli
  • 2,807
  • 1
  • 12
  • 31
16
votes
3 answers

How to delay throwError with RxJS?

As expected, the following code emits 42 after 5 seconds: const valueObservable = of(42).pipe(delay(5000)); valueObservable.subscribe((value) => console.log(value)); However, this throwing version errors immediately on subscription: const…
Lukas Renggli
  • 8,754
  • 23
  • 46
15
votes
3 answers

Returning caught error observable from catchError in HttpInterceptor causes error loop

I have a simple interceptor that handles requests and catches any http error using RXJS catchError. The second argument received in catchError is the caught observable. I want to, in some cases, return this error and let it propagate up to the error…
Jan Greger Hemb
  • 371
  • 1
  • 3
  • 17
15
votes
1 answer

error TS2339: Property 'takeUntil' does not exist on type 'Observable' and other rxjs v.6 errors

I just recently updated A LOT of packages in my angular project. Old package.json: { "name": "data-jitsu", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng…
Atticus29
  • 4,190
  • 18
  • 47
  • 84
15
votes
1 answer

Angular how do I filter the data from an observable using rxjs pipe

I make a call to a method called getWorkOrders() in my service file which in turn makes a call to the server to fetch the records. Here is my service. I am using the new HttpClient. export class BackendServices { private BASE_URL…
Sumchans
  • 3,088
  • 6
  • 32
  • 59
14
votes
1 answer

Ngrx store getting error as Property 'ofType' does not exist on type

I am trying to develop a application using ngrx/store getting error. unable to figureout the issue. any one help me? here is my errors: ERROR in src/app/store/effects/authentication.effects.ts(25,7): error TS2339: Property 'ofType' does not exist on…
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
13
votes
5 answers

ERROR Error: Uncaught (in promise): TypeError: i.BehaviorSubject is not a constructor in Angular 10 SSR

I'm getting this issue after build successfully and run on browser with angular universal Here is my package json : { "name": "ssr", "version": "1.0.0", "private": true, "dependencies": { "@angular/animations": "10.0.5", …
13
votes
1 answer

RXJS How do I use the result of one observable in another (and then process those two results together)

A very common problem when using RxJs seems to be to want the result of one or more observables to then use them in subsequent ones. e.g. in pseudo-code (This is not rx or valid js syntax deliberately) var someResult = $observable-A; // wait to…
James
  • 2,516
  • 2
  • 19
  • 31
13
votes
4 answers

How can I avoid multiple nested subscriptions using RxJS operators?

I am working on a file encryption and upload class using Angular. Many of these operations are async and therefore the methods I wrote are returning RxJS Observables. // 1. private prepareUpload(file): Observable; // 2. private encryptData(data,…
user11276880
13
votes
3 answers

Using rxjs ajax() I get "CORS is not supported by your browser"

Using Rxjs 6 I keep getting, Error: CORS is not supported by your browser My code is pretty simple, import { ajax } from 'rxjs/ajax'; const ajax$ = ajax({ url: genURL_chan(179), crossDomain: true, withCredentials: false, method: 'POST', …
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
13
votes
4 answers

How can I mock fromEvent function from RXJS 5.5.6?

I have to test a function that uses the fromEvent observable function. Before the upgrade to 'lettable' operators, I was just doing this: spyOn(Observable, 'fromEvent').and.callFake(mockFromEventFunction) But now, Rxjs have changed, and…
12
votes
3 answers

Jest not handling errors from expect() in subscribe() of RxJS observable

I've been trying to get Jest working with RxJS and am having trouble with Jest not propagating errors from inside the subscribe callback. Here is a sample test I've tried that is not working: import {of} from 'rxjs'; test('should fail', () => { …
brenmcnamara
  • 459
  • 3
  • 10
12
votes
1 answer

what is the difference between "new Observable()" and "of()" in RxJs

What is the difference between new Observable() and of() in RxJs? In my test cases when I try to return new Observable() it gives me a wired error and if I replace it with the of() from Rxjs it works fine. My impression was Observable.create(), new…
Aniruddha Das
  • 20,520
  • 23
  • 96
  • 132
12
votes
2 answers

How to target an HTML element using rxjs fromEvent in Angular 6

Issue I have used ngrx fromEvent operator to create an Observable from 2 input text fields, I have used document as target which is fine, but now I want to target only one input field. I am not sure sure what to use instead of document to target…
Dhirendra Kumar
  • 575
  • 1
  • 7
  • 19
12
votes
3 answers

distinctUntilChanged set initial value

For rxjs, can I provide an initial value when using distinctUntilChanged? It seems that the equals check is skipped entirely when no previous value was received. I'd like to not emit anything when the first value it receives is the initial…
Didii
  • 1,194
  • 12
  • 36
1 2
3
81 82