0
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'.
I wonder what I’m doing wrong?
please post the code instead of images. https://pt.meta.stackoverflow.com/questions/5483/manual-de-como-n%C3%83o-fazer-perguntas/5485#5485
– Eduardo Vargas