so i have been following this tutorial
CodePudding user response:
It's an error from typescript. By default in angular tsconfig.json
it has a configuration noImplicityAny
. That means, you have to specify types, otherwise typescript will yell at you
Quick Fix (not-recommendable)
this.databaseService.getProductList().subscribe((res: any) => {
this.products = res.values;
});
Recommended Fix
Service
interface Product {
...
}
interface ProductResponse {
values: Product[];
}
getProductList() {
return this.http.get<ProductResponse>('https://url/to/api');
}
// HomePage
products: Product[] = [];
this.databaseService.getProductList().subscribe((res) => {
this.products = res.values;
});