Cannot find module ‘rxjs-compat/Observable’

None of these answers are correct. Installing rxjs-compat is just a workaround. All you have to do is correct the imports. Use: import { Observable } from ‘rxjs’; Instead of: import { Observable } from ‘rxjs/Observable’; This last import is supposed to go away when they finally decide to kill rxjs-compat (hopefully very soon)… so … Read more

Property ‘filter’ does not exist on type ‘Observable’

UPDATE For RXJS 5.x version: import ‘rxjs/add/operator/filter’; For RXJS 6.x version: import { filter } from ‘rxjs/operators’; The following rules have been designed by the RxJS team to help JavaScript developers refactor import paths: rxjs/operators: Contains all pipeable operators. import { map, filter, scan } from ‘rxjs/operators’; rxjs: Contains creation methods, types, schedulers, and utilities. … Read more

Is it good to call subscribe inside subscribe?

The correct way is to compose the various observables in some manner then subscribe to the overall flow — how you compose them will depend on your exact requirements. If you can do them all in parallel: forkJoin( this.service.service1(), this.service.service2(), this.service.service3() ).subscribe((res) => { this.funcA(res[0], res[1], res[2]); }); If each depends on the result of … Read more

Angular2: convert array to Observable

You’re right there. If you already have the data in memory, you can use of observable (equivalent of return/just in RxJS 4). getContacts() { if(this.contacts != null) { return Observable.of(this.contacts); } else { return this.http.get(url) .map(res => <Contact[]> res.json()) .do(contacts => this.contacts = contacts) .catch(this.handleError); } }

Chaining Observables in RxJS

About promise composition vs. Rxjs, as this is a frequently asked question, you can refer to a number of previously asked questions on SO, among which : How to do the chain sequence in rxjs RxJS Promise Composition (passing data) RxJS sequence equvalent to promise.then()? Basically, flatMap is the equivalent of Promise.then. For your second … Read more

RxJS – observable doesn’t complete when an error occurs

That’s because an error means completion, so the callback associated to onCompleted never gets called. You can review here Rxjs contract for observables (http://reactivex.io/documentation/contract.html) : An Observable may make zero or more OnNext notifications, each representing a single emitted item, and it may then follow those emission notifications by either an OnCompleted or an OnError … Read more

Behaviour subject initial value null?

The purpose of BehaviorSubject is to provide initial value. It can be null or anything else. If no valid initial value can be provided (when user id isn’t known yet), it shouldn’t be used. ReplaySubject(1) provides a similar behaviour (emits last value on subscription) but doesn’t have initial value until it is set with next. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)