@Component({
  selector: 'app-sorted-heroes',
  template: `
{{hero.name}}
`, providers: [HeroService] }) export class SortedHeroesComponent extends HeroesBaseComponent { constructor(heroService: HeroService) { super(heroService); } protected afterGetHeroes() { this.heroes = this.heroes.sort((h1, h2) => { return h1.name < h2.name ? -1 : (h1.name > h2.name ? 1 : 0); }); } }