Blockquote
Registering providers in a component
Here's a revised HeroesComponent that registers the HeroService in its providers array.
import { Component } from '@angular/core';
import { HeroService } from './hero.service';
@Component({
selector: 'my-heroes',
providers: [HeroService],
template: `
`
})
export class HeroesComponent { }