import { Headers, Http } from '@angular/http';
@Injectable()
export class PublisherService{
private publishersUrl = 'app/publisher';
constructor(private http: Http) { }
getPublishers(): Promise<Publisher[]>{
return this.http.get(this.publishersUrl)
.toPromise()
.then(response => response.json().data)
.catch(this.handleError);
}
}
otrzymuję ten błąd:własność 'toPromise' nie istnieje w rodzaju 'obserwowalnych <Response>'
Property 'toPromise' does not exist on type 'Observable'.any
Normalnie, to nie jest dobry pomysł, aby przekształcić obserwable na obietnicach. Obserwowalne są o wiele potężniejsze – Dinistro