Category "rxjs"

RxJS: Removing fields from an object

Lets say I have an object with 4 fields like this: obj = {a:"3", b:"7", c:"10", d:"123"} and I need to 'narrow' it to an object with fewer fields, like that:

Angular click debounce

In my template I have a field and two buttons: <div class="btn-plus" (click)="add(1)"> - </div> <div class="txt"> {{ myValue }} </div>

Rxjs - resubscribe to unsubscribed Observable

I'm using a Service to "ping" my server every 2.5s, returning the response time from my server. Therefore I am using observables. I am also using angular 2 an

RxJs catch error and continue

I have a list of items to parse, but the parsing of one of them can fail. What is the "Rx-Way" to catch error but continue executing the sequence Code Sample:

Property 'subscribe' does not exist on type 'OperatorFunction<Response, Recipe[]>'

I'm trying to fetch data from firebase, but facing an error "Property 'subscribe' does not exist on type 'OperatorFunction'" any idea? whats missing here

When to use asObservable() in rxjs?

I am wondering what is the use of asObservable: As per docs: An observable sequence that hides the identity of the source sequence. But why would you

Is it possible to add observables to a combineLatest (or similar) at run time?

I have this use case. A component should NOT be visible when from a list of Boolean observables one of those is true. That is the easy part, for this, I have my

NgXs @selector doesn't support async functions

Inside my NGXS store I have the following async selector @Selector() static async mainState(store: IMyStore): Promise<IMyState> { return this.getActiv

Prevent multiple identical http calls from Angular service

I've a service to get the data from an API in my angular app. The service is used in different components - and the same http request is send multiple times. To

RxJs - lossy zip marble testing

Following this post I've decided to write a marble test for this operator. Here is a basic test: it('Test lossy zip', () => { const a = hot('a---a-

Is there a way to import rxjs into a plain js web custom component?

I'm trying to create web custom components using plain js. I would like to use rxjs and observables to fetch json content from a REST endpoint that I am also cr

How to make an rxjs marble sync grouping only take up one frame

According to https://github.com/ReactiveX/rxjs/blob/master/docs_app/content/guide/testing/marble-testing.md#marble-syntax '--(abc)-|': on frame 20, emit a, b, a

Property 'filter' does not exist on type 'unknown' Observable<Course[]> in Rxjs 6

As I'm trying to use filter like this. beginnerCourses$: Observable<Course[]>; advancedCourses$: Observable<Course[]>; ngOnInit() {

How to unit-test a valuechange of mat-autocomplete filtered search result in Angular?

I use the mat-autocomplete functionality for searching in projects and want to test if entering a search string, which cannot be found in the project list, lead

How do I get the last value from a ReplaySubject?

Below is a snippet that describes what I'm trying to do. In my application I have a replaysubject that's used throughout. At a certain point I want to get the

How to make one Observable sequence wait for another to complete before emitting?

Say I have an Observable, like so: var one = someObservable.take(1); one.subscribe(function(){ /* do something */ }); Then, I have a second Observable: var

Reconnecting a websocket in Angular and rxjs?

I have a ngrx/store (v2.2.2) and rxjs (v5.1.0) based application that listens to a web socket for incoming data using an observable. When I start the applicati

How to do something conditionally with Observables before subscribe?

I'm trying to implement a solution that execute the following steps: Check if a condition is valid with a filter. Check if Ctrl is pressed and execute some fun

RxJS pipe to filter into 2+branches

Let's assume we have a Subject, that can return a given set of values, all of which might require a different approach to them. We could debate whether or not t

How can I use RxJS to generate a requestAnimationFrame loop?

My goal is to create an animation loop à la requestAnimationFrame so that I could do something like this: animationObservable.subscribe(() => { /