Unclear instructions in Angular Hero Editor project

Viewed 1714

The tutorial for Angular Hero Editor states that to add a hero property to the HeroesComponent for a hero named "Windstorm" you should edit heroes.component.ts and add: hero = 'Windstorm';

However, it does not say where the code should be placed.

Where should I add the code to the file? Below is the contents of the file:

 import { Component, OnInit } from '@angular/core';
 @Component({
 selector: 'app-heroes',
 templateUrl: './heroes.component.html',
 styleUrls: ['./heroes.component.css']
})
export class HeroesComponent implements OnInit {

 constructor() { 

 }

 ngOnInit() {
}

}
2 Answers

Make hero = 'Windstorm'; a property of the component.

export class HeroesComponent implements OnInit {
  hero = 'Windstorm';

  constructor() {    
  }

  ngOnInit() {
  }
}
Related