webmaxru / pwa-workshop-angular

Demo App for Angular Mobile Toolkit workshop
40 stars 7 forks source link

Property 'map' does not exist on type 'Observable<Response>'. #2

Closed jziggas closed 6 years ago

jziggas commented 7 years ago

Followed the instructions in the README.md, got this error when running ng-serve.

jziggas commented 7 years ago

Installing RxJS types via yarn add @types/rx --dev resolved the error.

sarbull commented 6 years ago

Adding import 'rxjs/add/operator/map'; to the import section also does the trick.

Dinkymoo commented 6 years ago

I had to restart Visual Code for this to work.

Ukmandal commented 6 years ago

import 'rxjs/add/operator/map'; this does not work for me? i am getting error in map

//create a new Department createDepartment(name:string, description:string): Promise { let body = JSON.stringify({name:name, description:description}); return this.http.post(this._baseUrl+'department/', body) .toPromise() .map(res =>res.json().data as IDepartment) .catch(this.handleError) }

nagamallabhanu commented 6 years ago

Even I am facing the same issue

nagamallabhanu commented 6 years ago

Encapsulate map in pipe pipe(map(....))

quallio commented 6 years ago

@nagamallabhanu could you show us an example?? I have the same problem..

marcosmcb commented 6 years ago

Hi @fatigasbuenaonda I think sth like this - https://medium.com/coding-snippets/rxjs-5-5-property-map-does-not-exist-on-type-observable-e825129c2068 could do the job.

smitpatelx commented 6 years ago

THE FINAL ANSWER FOR THOSE WHO USES ANGULAR 6:

Add the below command in your *.service.ts file"

import { map } from "rxjs/operators";

**********************************************Example**Below**************************************
getPosts(){
this.http.get('http://jsonplaceholder.typicode.com/posts')
.pipe(map(res => res.json()));
}
}

I am using windows 10;

angular6 with typescript V 2.3.4.0

sunilkale24 commented 6 years ago

@smitpatelx thanks this is work for me...

SebigDev commented 6 years ago

Works fine. Thanks alot.

autocorrectoff commented 6 years ago

@smitpatelx thanks man

maksof-kashif commented 6 years ago

The angular new version does not support .map you have to install this through cmd npm install --save rxjs-compat via this you can enjoy with old technique . note: don't forget to import these lines. import { Observable, Subject } from 'rxjs'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; thank you

BenHenderson09 commented 6 years ago

@smitpatelx thanks, worked for me

hellobkrishna commented 6 years ago

@maksof-kashif thanks, its worked for me

arunariparambil commented 6 years ago

Thanks it's worked for me

avkbat commented 6 years ago

@smitpatelx - thanks a ton! it worked!!

webmaxru commented 6 years ago

Hello, folks! Thanks to everyone for helping out with fixing the issues. Just FYI: I work on a significant refactoring of this workshop, incorporating all the latest Angular/NGSW/Workbox updates. Of course, it all will be open-sourced. ETA: mid-September.

M-Tharwat commented 6 years ago

try to import : import 'rxjs/Rx';

Rename94 commented 6 years ago

npm install --save rxjs-compat@6 SOLVED

RatkoKovacevic commented 5 years ago

@smitpatelx thanks works for me

ChandrakantLedange commented 5 years ago

Works fine... thanks alot.

AdelekeAmoo commented 5 years ago

@maksof-kashif thanks

d4rkd0s commented 5 years ago

npm install --save rxjs-compat@6

@Rename94 that worked for me! thanks

orassr commented 5 years ago

@maksof-kashif Perfect!

FreddyKADIATA commented 5 years ago

THE FINAL ANSWER FOR THOSE WHO USES ANGULAR 6:

Add the below command in your *.service.ts file"

import { map } from "rxjs/operators";

**********************************************Example**Below**************************************
getPosts(){
this.http.get('http://jsonplaceholder.typicode.com/posts')
.pipe(map(res => res.json()));
}
}

I am using windows 10;

angular6 with typescript V 2.3.4.0

Merci beaucoup, j'avais le meme probleme, maintenant ca vas

devijonnalagadda commented 5 years ago

Encapsulate map in pipe pipe(map(....))

Working Fine. Thank you...

FreddyKADIATA commented 5 years ago

Thank

Le mer. 6 févr. 2019 à 08:48, devijonnalagadda notifications@github.com a écrit :

Encapsulate map in pipe pipe(map(....))

Working Fine. Thank you...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/webmaxru/pwa-workshop-angular/issues/2#issuecomment-460918332, or mute the thread https://github.com/notifications/unsubscribe-auth/Ahf8busNW-oUtC1izbT6npj0UvipxKi5ks5vKnqogaJpZM4OLnwp .

-- Freddy KADIATA

netopapa commented 5 years ago

Restart vs code and verify

webia1 commented 5 years ago

A further related topic: https://stackoverflow.com/questions/46005430/property-json-does-not-exist-on-type-object

Techiesachin-R commented 5 years ago

The angular new version does not support .map you have to install this through cmd npm install --save rxjs-compat via this you can enjoy with old technique . note: don't forget to import these lines. import { Observable, Subject } from 'rxjs'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; thank you

thank you it works for me.

manshell commented 5 years ago

@maksof-kashif you are the best, thanks

syednazurulislam commented 5 years ago

thanks it worked for me

Santoshah commented 5 years ago

This below code solved my issue.

` import { map } from 'rxjs/operators';

return this.http.delete("https://.........................herokuapp.com/item/"+id) .pipe(map(res => res.json()));`

BasemSaabneh commented 5 years ago

import { map } from 'rxjs/operators';

shadowmare358 commented 5 years ago

npm install --save rxjs-compat import { map } from 'rxjs/operators'; plus .pipe(map(...

HERVEKISS commented 5 years ago

first install the falowing: npm install --save rxjs-compat

and import: import { Observable, Subject } from 'rxjs';

import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch';

davmszd commented 4 years ago

npm install --save rxjs-compat@next worked for me.

kumarideepika commented 4 years ago

The angular new version does not support .map you have to install this through cmd npm install --save rxjs-compat via this you can enjoy with old technique . note: don't forget to import these lines. import { Observable, Subject } from 'rxjs'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; thank you

Thank you its working well

ankitbinjola commented 4 years ago

thanks

Kartik618 commented 4 years ago

thanks

fadhlaouir commented 4 years ago

import 'rxjs/add/operator/map'; if does not work run npm install --save rxjs-compat

kumarideepika commented 4 years ago

thanks a lot

On Fri, Apr 10, 2020 at 12:22 AM Fadhlaoui Raed notifications@github.com wrote:

import 'rxjs/add/operator/map'; if does not work just restart the vscode

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/webmaxru/pwa-workshop-angular/issues/2#issuecomment-611695064, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJA5QLUJQMJOELZSTLQ23NLRLYKNHANCNFSM4DROPQUQ .

veracubano commented 4 years ago

Yo tenía este problema: Property 'map' does not exist on type 'Observable'.

La solución la encontré en: npm install --save rxjs-compat

y con: import 'rxjs/add/operator/map';

ASKN2811 commented 4 years ago

import {Observable} from 'rxjs/Rx'; This worked for me.