修订完hierarchical-DI

This commit is contained in:
Zhicheng Wang 2017-04-15 21:36:40 +08:00
parent 116308caa2
commit d33efdab08
1 changed files with 4 additions and 1 deletions

View File

@ -50,6 +50,9 @@ block includes
You won't notice the difference and You won't notice the difference and
your mental model should be that every component has its own injector. your mental model should be that every component has its own injector.
组件的注入器可能是一个组件树中更高级的祖先注入器的*代理*。
但这只是提升效率的实现细节,我们不用在乎这点差异,在你的脑海里只要想象成每个组件都有自己的注入器就可以了。
:marked :marked
Consider this guide's variation on the Tour of Heroes application . Consider this guide's variation on the Tour of Heroes application .
At the top is the `AppComponent` which has some sub- components. At the top is the `AppComponent` which has some sub- components.
@ -88,7 +91,7 @@ figure.image-display
The hunt for providers will climb no higher than the injector for that host component. The hunt for providers will climb no higher than the injector for that host component.
This is a topic for another day. This is a topic for another day.
我们还可以“盖住”这次冒泡。一个中层的组件可以声称自己是“宿主”组件。 我们还可以“盖住”这次冒泡。一个中层的组件可以声称自己是“宿主”组件。
向上查找提供商的过程会截止于这个“宿主”组件。 向上查找提供商的过程会截止于这个“宿主”组件。
我们先保留这个问题,等改天再讨论这个选项。 我们先保留这个问题,等改天再讨论这个选项。