I am very new in Angular2/4 and I have some problem trying to follow this tutorial related to PrimeNG:
https://www.primefaces.org/primeng/#/schedule
I created the EventService class into a file in my prohject, in this way:
import {Injectable} from '@angular/core';
import {Http} from '@angular/http';
@Injectable()
export class EventService {
constructor(private http: Http) {}
getEvents() {
return this.http.get('showcase/resources/data/scheduleevents.json')
.toPromise()
.then(res => <any[]> res.json().data)
.then(data => { return data; });
}
}
The problem is that WebStorm give me an error on the toPromise() method, it says:
Error:(11, 8) TS2339:Property 'toPromise' does not exist on type 'Observable<Response>'.
Why? What it means? What is the problem? How can I try to fix it?