Q: Angular2: ‘switchMap’ does not exist on type ‘Observable’

You need to import the switchMap operator:

import 'rxjs/add/operator/switchMap';

update for rxjs >=5.5.0:

for rxjs@5.5.0 or higher it’s recommended to use the pipe operator instead of augmentation:

import { switchMap } from 'rxjs/operators';

\\...

this.route.params.pipe(switchMap((params: Params) => /*... */))
  .subscribe(/*... */);
\\...

(this avoids side effects and enable better bundle size optimization)

Leave a Comment

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