I think you should first check if data is defined when you print it in browser.
{{data[0]?.name}}
As your data is not defined initially, you cannot access the name property of it.
Documentation
The Angular safe navigation operator (?.) is a fluent and convenient
way to guard against null and undefined values in property paths. Here
it is, protecting against a view render failure if the currentHero is
null.
You can also check if the variable is null or not by using &&
condition
{{data[0] && data[0].name}}