Having trouble mapping fetched JSON data from the API to an existing object in TypeScript. Here is my code:
https://i.sstatic.net/1UVg4.png
This is my Hero Interface:
export interface Hero {
id: number;
name: string;
}
When I console log:
https://i.sstatic.net/BIy7n.png
The result of this.hero
is always empty (undefined). Can someone help me solve this issue? PS. I'm new to Angular and TypeScript.