docs(dependency-injection): tweak Dart wording

closes #1017
This commit is contained in:
Kathy Walrath 2016-03-29 13:48:41 -07:00
parent 3b768a341c
commit e2c77ad55c
2 changed files with 11 additions and 8 deletions

View File

@ -704,10 +704,13 @@ code-example(format, language="html").
The injector resolves these tokens and injects the corresponding services into the matching factory function parameters. The injector resolves these tokens and injects the corresponding services into the matching factory function parameters.
// #enddocregion providers-factory-4 // #enddocregion providers-factory-4
// #docregion providers-factory-5 // #docregion providers-factory-5
- var lang = current.path[1]
- var anexportedvar = lang == 'dart' ? 'a constant' : 'an exported variable'
- var variable = lang == 'dart' ? 'constant' : 'variable'
:marked :marked
Notice that we captured the factory provider in an exported variable, `heroServiceProvider`. Notice that we captured the factory provider in #{anexportedvar}, `heroServiceProvider`.
This extra step makes the factory provider reusable. This extra step makes the factory provider reusable.
We can register our `HeroService` with this variable wherever we need it. We can register our `HeroService` with this #{variable} wherever we need it.
In our sample, we need it only in the `HeroesComponent`, In our sample, we need it only in the `HeroesComponent`,
where it replaces the previous `HeroService` registration in the metadata `providers` array. where it replaces the previous `HeroService` registration in the metadata `providers` array.

View File

@ -571,7 +571,7 @@ table
If the name fails to match a property of a known directive or element, Angular reports an “unknown directive” error. If the name fails to match a property of a known directive or element, Angular reports an “unknown directive” error.
### Avoid side effects ### Avoid side effects
As we've already discussed, evaluation of a template expression should have no visible side effects. The expression language itself does its part to keep us safe. We cant assign a value to anything in a property binding expression nor use the increment and decorator operators. As we've already discussed, evaluation of a template expression should have no visible side effects. The expression language itself does its part to keep us safe. We cant assign a value to anything in a property binding expression nor use the increment and decrement operators.
Of course, our expression might invoke a property or method that has side effects. Angular has no way of knowing that or stopping us. Of course, our expression might invoke a property or method that has side effects. Angular has no way of knowing that or stopping us.