0
    import { Injectable } from '@angular/core';
    import { Http,Headers } from '@angular/http';
     import { List } from '../models/List'
     import {Observable} from 'rxjs/Rx';
     import 'rxjs/add/operator/map';

     @Injectable()
export class ListService {

    constructor(private http: Http) { }

    private serverApi= 'http://localhost:3000';

    public getAllLists():Observable<List[]> {

        let URI = `${this.serverApi}/bucketlist/`;
        return this.http.get(URI)
            .map(res => res.json())

            .map(res => <List[]>res.lists);
    }

    public deleteList(listId : string) {
      let URI = `${this.serverApi}/bucketlist/${listId}`;
        let headers = new Headers;
        headers.append('Content-Type', 'application/json');
        return this.http.delete(URI, {headers})
        .map(res => res.json());
    }
}

i am getting error Property map is not available on type Observable please anyone help

BlackBeard
  • 10,246
  • 7
  • 52
  • 62
learner
  • 1
  • 3
  • What rxjs version are you using ? – ibenjelloun May 25 '18 at 10:40
  • i am using 6.2.0 version of rxjs i have started coding again in angular after 2 months earlier it worked but now it shows error – learner May 25 '18 at 10:45
  • 1
    why are you using `HttpModule` it is deprecated use `HttpClientModule` instead – Vikas May 25 '18 at 11:23
  • Possible duplicate of [Error: Property 'map' does not exist on type 'Observable'](https://stackoverflow.com/questions/50503366/error-property-map-does-not-exist-on-type-observable) – FAISAL May 25 '18 at 11:25

1 Answers1

1

IMHO, you are using old syntax.

Do the following:

import { map } from 'rxjs/operators';

then:

this.myObservableFunctionCall().pipe(map(data => {}))
BlackBeard
  • 10,246
  • 7
  • 52
  • 62