parent
f3c69e7f6b
commit
a50c1bb7bc
|
@ -143,7 +143,7 @@ Learn more about [where to configure providers](guide/hierarchical-dependency-in
|
|||
|
||||
## Injecting services
|
||||
|
||||
In order for `HeroListComponent` to get heroes from `HeroService`, it needs to ask for `HeroService` to be injected, rather than creating it's own `HeroService` instance with `new`.
|
||||
In order for `HeroListComponent` to get heroes from `HeroService`, it needs to ask for `HeroService` to be injected, rather than creating its own `HeroService` instance with `new`.
|
||||
|
||||
You can tell Angular to inject a dependency in a component's constructor by specifying a **constructor parameter with the dependency type**. Here's the `HeroListComponent` constructor, asking for the `HeroService` to be injected.
|
||||
|
||||
|
|
Loading…
Reference in New Issue