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);
}
}
I am getting this error:
Property 'toPromise' does not exist on type 'Observable'.any
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…