Questions tagged [rxjs6]

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

1219 questions
184
votes
16 answers

Angular - "has no exported member 'Observable'"

Typescript code: import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { of } from 'rxjs/observable/of'; import { Hero } from './hero'; import { HEROES } from './mock-heroes'; @Injectable({ providedIn:…
Thomas Lee
  • 2,757
  • 2
  • 11
  • 13
177
votes
11 answers

Upgrading to Angular 10 - Fix CommonJS or AMD dependencies can cause optimization bailouts

I am trying to upgrade my Angular 9 app to Angular 10 version, but I am getting the below warning after the upgrade rxjs\BehaviorSubject.js depends on rxjs-compat/BehaviorSubject How can I fix this?
Ora
  • 1,889
  • 2
  • 9
  • 9
103
votes
6 answers

combineLatest deprecated in favor of static combineLatest

After running the rxjs migration tool using rxjs-5-to-6-migrate -p src/tsconfig.app.json I'm now getting a linting error: combineLatest is deprecated: Deprecated in favor of static combineLatest. Here is my code before running the migration…
Samer
  • 3,848
  • 4
  • 25
  • 24
89
votes
7 answers

Angular 6 View is not updated after changing a variable within subscribe

Why is the view not being updated when a variable changes within a subscribe? I have this code: example.component.ts testVariable: string; ngOnInit() { this.testVariable = 'foo'; this.someService.someObservable.subscribe( () =>…
82
votes
7 answers

forkJoin is deprecated: resultSelector is deprecated, pipe to map instead

I'm working on an Angular 6 project. Running ng lint gives the following Warning: "forkJoin is deprecated: resultSelector is deprecated, pipe to map instead" forkJoin(...observables).subscribe( Any idea? Can't seem to find any information about…
robert
  • 5,742
  • 7
  • 28
  • 37
64
votes
3 answers

Could not use Observable.of in RxJs 6 and Angular 6

import { Observable, of } from "rxjs"; // And if I try to return like this return Observable.of(this.purposes); I am getting an error stating, Property 'of' does not exist on type 'typeof Observable'
Harish Krishnan
  • 1,693
  • 4
  • 17
  • 25
62
votes
2 answers

Using shareReplay(1) in Angular - still invokes http request?

I've created a demo (ng-run) where I have a button which invokes an Http request. When the button is clicked, I invoke this method : public getData(){ this._jokeService.getData().subscribe(); } Which in turn invokes this ( from a service) : …
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
55
votes
7 answers

Angular/RxJS 6: How to prevent duplicate HTTP requests?

Currently have a scenario where a method within a shared service is used by multiple components. This method makes an HTTP call to an endpoint that will always have the same response and returns an Observable. Is it possible to share the first…
patryk0605
  • 1,081
  • 1
  • 9
  • 10
54
votes
3 answers

Angular 6 router.events.filter 'filter' does not exist on type 'Observable'

I have finished to update my App to Angular 6 (it was in 5.2 version). I got an error syntax in : import { Router, ActivatedRoute, NavigationEnd } from '@angular/router'; import { filter } from 'rxjs/operators'; ... constructor(private router:…
Anouar Mokhtari
  • 2,084
  • 4
  • 23
  • 23
49
votes
5 answers

Property 'do' does not exist on type 'Observable'

After upgrading to Angular 6.0 and Rxjs to 6.0 I receive the following compilation error: Property 'do' does not exist on type 'Observable'. Here is the code: import { Observable, of } from 'rxjs'; import 'rxjs/add/operator/do'; import…
Urgen
  • 1,095
  • 3
  • 19
  • 39
41
votes
4 answers

Where is RxJS 6 static merge?

In RxJS 6, how do I import a static merge function for merging a list of Observables? I want to be able to do: const merged$ = merge( obs1$, obs2$, obs3$ ); I've tried: import { merge } from 'rxjs/observable/merge'; and import { merge…
bingles
  • 11,582
  • 10
  • 82
  • 93
35
votes
3 answers

Angular : how to call finally() with RXJS 6

I was using RXJS 5, now as I upgraded it to 6, I am facing some problems. Previously I was able to use catch and finally but as per update catch is replaced with catchError (with in the pipe) now how to use finally? Also I have some questions : Do I…
Sunil Kumar
  • 909
  • 2
  • 17
  • 31
33
votes
2 answers

Why would I use RxJS interval() or timer() polling instead of window.setInterval()?

Use case: Call a function every minute (60000 ms) that dispatches store action to fetch lastUpdated status of items, which upon response and filtering, updates the store, and updated store is read as an observable and displayed in the view). This…
msamprz
  • 573
  • 2
  • 7
  • 15
33
votes
2 answers

How do you sort an Observable in Angular 6 with rxjs 6?

I just want to sort data on an observable of my class type 'Category'. So Observable < Category[] > I want to sort. So I upgraded to Angular6 and rxjs6 with it. One issue that is probably simple Typescript that I do know is how do I just do a…
djangojazz
  • 14,131
  • 10
  • 56
  • 94
32
votes
4 answers

Error: Can't resolve 'rxjs/add/operator/map'

This is app.module.ts I have tried to done the Import of map in different project and it worked fine, but in this project it's not working. import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; …
Asad
  • 617
  • 2
  • 8
  • 23
1
2 3
81 82