I am using Angular 6 where I am getting two errors -
ERROR in ./src/app/app/img/img.service.ts Module not found: Error: Can't resolve 'rxjs/add/operator/map' in '/Users/user/Projects/A4/imageSearch/src/app/app/img'
ERROR in src/app/app/img/img.service.ts(21,9): error TS2339: Property 'map' does not exist on type 'Observable'.
Run command in your package.
npm install --save rxjs-compat
And import below line in your file.
import 'rxjs-compat';
With rxjs 6, import path is changed. Please import operator like this
Hope it will work.
I faced similar problem with
rxjs
map
operator. Currently I'm using Angular 6. To know which version you are using:or
If you are also using angular 6, then please checkout https://www.academind.com/learn/javascript/rxjs-6-what-changed/
Let's say you use map for
http.get
method:NOT:
this.http.get(this.url).map(result => result);
This is how we can import observable and map in rxjs 6