I'm starting now with Angular 6.
When I tried to create a service to consume data from an api, the following error appeared:
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs';
import { CategoriaModel } from './categoria/categoria.model';
import { PRODUTOS_API } from './../../app.api';
@Injectable()
export class CategoriasService{
constructor(private http: Http){}
categorias(): Observable<CategoriaModel[]>{
return this.http.get('${PRODUTOS_API}/categorias').map(response => response.json())
}
}
Error: Property 'map' does not exist on type 'Observable'.
What am I doing wrong?