./src/app/services/articles.service.ts:2:0-15 - Error: Module not found: Error: Resolving to directories is not possible with the exports field (request was ./)
Error: src/app/services/articles.service.ts:21:10 - error TS2339: Property 'map' does not exist on type 'Observable<Object>'.
21 .map((data : Object[])=> {
~~~
✖ Failed to compile.
import { Injectable } from "@angular/core"; import { HttpClient } from "@angular/common/http"; import { Observable } from "rxjs"; import 'rxjs/'class Repo{ constructor(public id : string, public name : string){}; }
@Injectable() export class ArticlesService{
public articlesCount : number = 0; constructor(private http : HttpClient){ } getAll(){ this.http.get('https://pokeapi.co/api/v2/ability/') .map((data : Object[])=> { return data.map((r : any)=> new Repo(r.id,r.name)) }) .subscribe((data : any) => { console.log(data); }) } buildObservable() : Observable<any>{ let number = 0; return new Observable(function (observer) { setInterval(() => observer.next(number++), 1000); }) }
}