I have a list of hero-buttons with a custom animation created in button.component.ts. At the beginning, they are inactive. When I press one of then, the selecte
button.component.ts
Your service most probably only returns plain objects, meaning they don't have the member methods of the Hero class.
Hero
You need to explicitly create new Hero() objects to have the toggleState() method available on the hero object.
new Hero()
toggleState()
hero