我不知道为什么会出现这个错误,我按照角色英雄之旅教程
代码:
public productsURL = 'http://localhost:3000/api/productos'; // URL to web api
constructor(
private http: HttpClient,
private messageService: MessageService) { }
getProducts (): Observable<Product[]> {
return this.http.get<Product[]>(this.productsURL)
.pipe(
tap(products => this.log(`fetched heroes`)),
catchError(this.handleError('getProducts', []))
);
}