把alternative统一改为备选或替代品(取决于语境)

This commit is contained in:
Zhicheng Wang 2016-06-21 07:54:34 +08:00
parent dca575f617
commit 64b9e476fb
7 changed files with 14 additions and 14 deletions

View File

@ -66,7 +66,7 @@ include ../_util-fns
[Define providers with object literals](#object-literals)
[使用对象文本定义供应商] (#object-literals)
[使用对象字面量定义供应商] (#object-literals)
[Provider token alternatives](#tokens)
@ -696,7 +696,7 @@ figure.image-display
The `HeroOfTheMonthComponent` example demonstrates many of the alternatives and why we need them.
`HeroOfTheMonthComponent`例子示范了一些备选方案,展示了为什么需要它们。
`HeroOfTheMonthComponent`例子示范了一些替代方案,展示了为什么需要它们。
figure.image-display
img(src="/resources/images/cookbooks/dependency-injection/hero-of-month.png" alt="Hero of the month" width="300px")
@ -789,7 +789,7 @@ a(id='useclass')
The alternative could implement a different strategy, extend the default class,
or fake the behavior of the real class in a test case.
使用该技术来为公共或默认类***提供候选实现***。该候选项能实现一个不同的策略,比如拓展默认类或者在测试的时候假冒真实类。
使用该技术来为公共或默认类***提供备选实现***。该替代品能实现一个不同的策略,比如拓展默认类或者在测试的时候假冒真实类。
We see two examples in the `HeroOfTheMonthComponent`:
@ -933,7 +933,7 @@ a(id="tokens")
:marked
## Provider token alternatives: the *class-interface* and *OpaqueToken*
## 选供应商令牌:*类-接口*和*OpaqueToken*
## 选供应商令牌:*类-接口*和*OpaqueToken*
Angular dependency injection is easiest when the provider *token* is a class
that is also the type of the returned dependency object (what we usually call the *service*).

View File

@ -186,7 +186,7 @@ figure
For example, we import the Angular **`Component` *function*** from the *@angular/core* module like this:
从Angular模块库中导入所需内容的方式都差不多。
比如,从*@angular2/core*中导入Angular **`Component`*函数***的代码是这样的:
比如,从*@angular/core*中导入Angular **`Component`*函数***的代码是这样的:
+makeExample('architecture/ts/app/app.component.ts', 'import')(format=".")
:marked

View File

@ -787,7 +787,7 @@ code-example(format="nocode").
We could give it a provider that calls a logger factory function.
Any of these approaches might be a good choice under the right circumstances.
我们可以使用另外的各种供应商来配置这个注入器,只要它们能交付#{objectlikeCn}`Logger`就可以了。
我们可以使用其它备选供应商来配置这个注入器,只要它们能交付#{objectlikeCn}`Logger`就可以了。
我们可以提供一个替身类。#{loggerlikeCn}
我们可以给它一个供应商,让它调用一个可以创建日志服务的工厂函数。
所有这些方法,只要用在正确的场合,都可能是一个好的选择。
@ -839,7 +839,7 @@ block provider-ctor-args
:marked
### Alternative class providers
### 其他的“类”供应商
### 备选的“类”供应商
Occasionally we'll ask a different class to provide the service.
The following code tells the injector

View File

@ -826,7 +826,7 @@ h2#cors 跨域请求Wikipedia范例
Some servers do not support CORS but do support an older, read-only alternative called [JSONP](https://en.wikipedia.org/wiki/JSONP).
Wikipedia is one such server.
有些服务器不支持CORS但支持一种老的、只读的(译注即仅支持GET)替代协议,这就是[JSONP](https://en.wikipedia.org/wiki/JSONP)。
有些服务器不支持CORS但支持一种老的、只读的(译注即仅支持GET)备选协议,这就是[JSONP](https://en.wikipedia.org/wiki/JSONP)。
Wikipedia就是一个这样的服务器。
.l-sub-section
:marked

View File

@ -2228,7 +2228,7 @@ a(href="#toc") 回到顶部
:marked
**Why?** Angular allows for an [alternative syntax](https://angular.io/docs/ts/latest/guide/template-syntax.html#!#binding-syntax) `on-*`. If the event itself was prefixed with `on` this would result in an `on-onEvent` binding expression.
**为何?**Angular允许[选语法](https://angular.io/docs/ts/latest/guide/template-syntax.html#!#binding-syntax) `on-*`。如果事件的名字本身带有前缀`on`,那么绑定的表达式可能是`on-onEvent`。
**为何?**Angular允许[另一种备选语法](https://angular.io/docs/ts/latest/guide/template-syntax.html#!#binding-syntax) `on-*`。如果事件的名字本身带有前缀`on`,那么绑定的表达式可能是`on-onEvent`。
+makeExample('style-guide/ts/05-16/app/heroes/hero.component.avoid.ts', 'example', 'app/heroes/hero.component.ts')(avoid=1)
:marked

View File

@ -236,7 +236,7 @@ block template-expressions-cannot
A [template reference variable](#ref-vars) is one such alternative context object.
表达式的上下文也包括组件之外的对象。
[模板引用变量](#ref-vars)就是另外的上下文对象之一。
[模板引用变量](#ref-vars)就是备选的上下文对象之一。
:marked
<a id="no-side-effects"></a>
@ -403,7 +403,7 @@ block statement-context
representing the "message" or "payload" of the raised event.
语句上下文可以包含组件之外的对象。
[模板引用对象](#ref-vars)就是这些选上下文对象中的一个。
[模板引用对象](#ref-vars)就是这些选上下文对象中的一个。
在事件绑定语句中,我们将频繁的看到被保留的`$event`符号,它代表来自所触发事件的“消息”或“有效载荷”。
### Statement guidelines
@ -980,7 +980,7 @@ a(id="one-time-initialization")
In fact, Angular translates those interpolations into the corresponding property bindings
before rendering the view.
在多数情况下,插值表达式是一个更方便的选择。实际上在渲染视图之前Angular就把这些插值表达式翻译成了对应的属性绑定形式。
在多数情况下,插值表达式是一个更方便的备选项。实际上在渲染视图之前Angular就把这些插值表达式翻译成了对应的属性绑定形式。
There is no technical reason to prefer one form to the other.
We lean toward readability, which tends to favor interpolation.
@ -1237,7 +1237,7 @@ block style-property-name-dart-diff
:marked
Some people prefer the `on-` prefix alternative, known as the *canonical form*:
有些人更喜欢带`on-`前缀的选形式,称之为*规范形式*
有些人更喜欢带`on-`前缀的选形式,称之为*规范形式*
+makeExample('template-syntax/ts/app/app.component.html', 'event-binding-2')(format=".")
:marked
Element events may be the more common targets, but Angular looks first to see if the name matches an event property

View File

@ -605,7 +605,7 @@ h2#index 步骤4添加#[code index.html]
本“快速起步”使用<a href="https://github.com/systemjs/systemjs" target="_blank">SystemJS</a>来加载应用和库模块。
[以前](#add-config-files)我们曾把`systemjs.config.js`文件添加到项目的根目录。
还有一些其它候选者也能很好地工作,比如备受推崇的[webpack](guide/webpack.html)。
还有另一些替代方案也能很好的工作,比如备受推崇的[webpack](guide/webpack.html)。
SystemJS是一个好的选择但要清楚它只是“选择之一”而不是“首选项”。
All module loaders require configuration and all loader configuration