0
 TypeError: rxjs_Observable__WEBPACK_IMPORTED_MODULE_3__.Observable.combineLatest is not a function.

Angular version 6.2.2, rxjs: 6.3.2.

My code is given below:

ngOnInit() {
  Observable.combineLatest([
    this.route.paramMap,
    this.route.queryParamMap
  ])
  .switchMap(combined => {
    let id = combined[0].get('id');
    let page = combined[1].get('page');

    return this.service.getAll();
  })
  .subscribe(followers => this.followers = followers);  
}

Trying get the list of followers using http request path given in some other file.

Drenmi
  • 8,492
  • 4
  • 42
  • 51
Akshay
  • 1
  • 3

1 Answers1

2

combineLatest is not part of the observable object. just use combineLatest. Also, wrap the switchMap around pipe function

import { combineLatest } from 'rxjs';
import { switchMap } from 'rxjs/operators';

let observerObj = combineLatest([
     this.route.paramMap,
     this.route.queryParamMap
 ]);
observerObj
  .pipe(
    switchMap(combined => {
        let id = combined[0].get('id');
        let page = combined[1].get('page');
        return this.service.getAll();
    })
  ) 
  .subscribe(followers => this.followers = followers);
Sachila Ranawaka
  • 39,756
  • 7
  • 56
  • 80