This repository was archived by the owner on Dec 4, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
public/docs/ts/latest/guide Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -704,10 +704,13 @@ code-example(format, language="html").
704
704
The injector resolves these tokens and injects the corresponding services into the matching factory function parameters.
705
705
// #enddocregion providers-factory-4
706
706
// #docregion providers-factory-5
707
+ - var lang = current .path [1 ]
708
+ - var anexportedvar = lang == ' dart' ? ' a constant' : ' an exported variable'
709
+ - var variable = lang == ' dart' ? ' constant' : ' variable'
707
710
:marked
708
- Notice that we captured the factory provider in an exported variable , `heroServiceProvider`.
711
+ Notice that we captured the factory provider in #{anexportedvar} , `heroServiceProvider`.
709
712
This extra step makes the factory provider reusable.
710
- We can register our `HeroService` with this variable wherever we need it.
713
+ We can register our `HeroService` with this #{ variable} wherever we need it.
711
714
712
715
In our sample, we need it only in the `HeroesComponent`,
713
716
where it replaces the previous `HeroService` registration in the metadata `providers` array.
You can’t perform that action at this time.
0 commit comments