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);
}
}
我收到此错误:
属性'toPromise'在'Observable'类型上不存在。