更正了technically的翻译
This commit is contained in:
parent
78418f4d3c
commit
41b0cc800b
|
@ -260,7 +260,7 @@ figure.image-display
|
|||
The `LoggerService` doesn't depend on anything. The logger would work if we omitted `@Injectable()`
|
||||
and the generated code would be slightly smaller.
|
||||
|
||||
从技术上讲,这个`@Injectable()`装饰器只在一个服务类有_自己的依赖_的时候,才是_不可缺少_的。
|
||||
严格来说,这个`@Injectable()`装饰器只在一个服务类有_自己的依赖_的时候,才是_不可缺少_的。
|
||||
`LoggerService`不依赖任何东西,所以该日志服务在没有`@Injectable()`的时候应该也能工作,生成的代码也更少一些。
|
||||
|
||||
But the service would break the moment we gave it a dependency and we'd have to go back and
|
||||
|
@ -1394,7 +1394,7 @@ a(id="parent-token")
|
|||
Although the `AlexComponent` has a `name` property (as required by its `Base` class)
|
||||
its class signature doesn't mention `Parent`:
|
||||
|
||||
这样做可以提升代码的清晰度。但在技术上,这并不是必须的。虽然`AlexComponent`有一个`name`属性(来自`Base`类的要求),但它的类签名并不需要提及`Parent`。
|
||||
这样做可以提升代码的清晰度,但严格来说并不是必须的。虽然`AlexComponent`有一个`name`属性(来自`Base`类的要求),但它的类签名并不需要提及`Parent`。
|
||||
|
||||
+makeExample('cb-dependency-injection/ts/app/parent-finder.component.ts','alex-class-signature','parent-finder.component.ts (AlexComponent class signature)')(format='.')
|
||||
.l-sub-section
|
||||
|
|
|
@ -615,7 +615,7 @@ figure
|
|||
While **a component is technically a directive**,
|
||||
components are so distinctive and central to Angular applications that this architectural overview separates components from directives.
|
||||
|
||||
虽然**组件从技术角度看就是一个指令**,但是组件非常独特,并在Angular中位于中心地位,所以在架构概览中,我们把组件从指令中独立了出来。
|
||||
虽然**严格来说组件就是一个指令**,但是组件非常独特,并在Angular中位于中心地位,所以在架构概览中,我们把组件从指令中独立了出来。
|
||||
|
||||
:marked
|
||||
Two *other* kinds of directives exist: _structural_ and _attribute_ directives.
|
||||
|
|
|
@ -147,7 +147,7 @@ block highlight-directive-1
|
|||
### 为什么不直接叫做"highlight"?
|
||||
*highlight* is a nicer name than *myHighlight* and, technically, it would work if we called it that.
|
||||
|
||||
从技术上说,*highlight*是一个比*myHighlight*更好的名字,而且在这里它确实能工作。
|
||||
理论上,*highlight*是一个比*myHighlight*更好的名字,而且在这里它确实能工作。
|
||||
|
||||
However, we recommend picking a selector name with a prefix to ensure
|
||||
that it cannot conflict with any standard HTML attribute, now or in the future.
|
||||
|
|
|
@ -641,7 +641,7 @@ block injectable-not-always-needed-in-ts
|
|||
We recommend adding `@Injectable()` to every service class, even those that don't have dependencies
|
||||
and, therefore, do not technically require it. Here's why:
|
||||
|
||||
我们建议为每个服务类都添加`@Injectable()`,包括那些没有依赖所以技术上不需要它的。因为:
|
||||
我们建议为每个服务类都添加`@Injectable()`,包括那些没有依赖因此严格来说并不需要它的。因为:
|
||||
|
||||
ul(style="font-size:inherit")
|
||||
li <b>Future proofing:</b> No need to remember <code>@Injectable()</code> when we add a dependency later.
|
||||
|
|
|
@ -252,7 +252,7 @@ figure.image-display
|
|||
:marked
|
||||
Technically we could, but our component wouldn’t quite behave the way it is supposed to. Remember that each injector treats the services that it provides as singletons. However, in order to be able to have multiple instances of `HeroEditComponent` edit multiple heroes at the same time we need to have multiple instances of the `RestoreService`. More specifically, each instance of `HeroEditComponent` needs to be bound to its own instance of the `RestoreService`.
|
||||
|
||||
从技术上讲,可以。但我们的组件将不会像预期的那样工作。记住,每个注入器都会把它提供的服务处理成单例。
|
||||
虽然理论上可以,但我们的组件却无法像预期的那样工作。记住,每个注入器都会把它提供的服务处理成单例。
|
||||
可是,我们需要同时用多个`HeroEditComponent`实例来编辑多个英雄,这就意味着我们需要`RestoreService`的多个实例。
|
||||
更明确的说,每个`HeroEditComponent`的实例都得绑定到它自己的`RestoreService`实例。
|
||||
|
||||
|
|
|
@ -1489,7 +1489,7 @@ a#shared-module
|
|||
As it happens, the components declared by `SharedModule` itself don't bind with `[(ngModel)]`.
|
||||
Technically, there is no need for `SharedModule` to import `FormsModule`.
|
||||
|
||||
实际上,`SharedModule`本身所声明的组件没绑定过`[(ngModel)]`,那么,从技术角度看`SharedModule`并不需要导入`FormsModule`。
|
||||
实际上,`SharedModule`本身所声明的组件没绑定过`[(ngModel)]`,那么,严格来说`SharedModule`并不需要导入`FormsModule`。
|
||||
|
||||
`SharedModule` can still export `FormsModule` without listing it among its `imports`.
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ figure.image-display
|
|||
|
||||
`transform`方法是管道的基本要素。
|
||||
`PipeTransform`*接口*中定义了它,并用它指导各种工具和编译器。
|
||||
从技术角度看,它是可选的。Angular不会管它,而是直接查找并执行`transform`方法。
|
||||
严格来说,它是可选的。Angular不会管它,而是直接查找并执行`transform`方法。
|
||||
|
||||
:marked
|
||||
Now we need a component to demonstrate our pipe.
|
||||
|
|
|
@ -2551,7 +2551,7 @@ code-example.
|
|||
In our example, the redirect is at the top level of the route configuration tree so the *remaining* URL and the *entire* URL
|
||||
are the same thing.
|
||||
|
||||
从技术的角度看,`pathMatch = 'full'`导致路由器尝试用URL中*剩下的*、未匹配过的片段去匹配`''`。
|
||||
从原理上说,`pathMatch = 'full'`导致路由器尝试用URL中*剩下的*、未匹配过的片段去匹配`''`。
|
||||
在这个例子中,重定向发生在路由配置树的顶级,所以*剩下的*URL和*完整的*URL是完全一样的。
|
||||
|
||||
The other possible `pathMatch` value is `'prefix'` which tells the router
|
||||
|
|
|
@ -875,7 +875,7 @@ table
|
|||
one of the property names listed in the directive’s `inputs` array or a property decorated with `@Input()`.
|
||||
Such inputs map to the directive’s own properties.
|
||||
|
||||
从技术的角度看,Angular正在匹配一个指令的[input](#inputs-outputs)的名字。这个名字是指令的`inputs`数组中所列的名字之一,或者是一个带有`@Input()`装饰器的属性。
|
||||
严格来说,Angular正在匹配一个指令的[input](#inputs-outputs)的名字。这个名字是指令的`inputs`数组中所列的名字之一,或者是一个带有`@Input()`装饰器的属性。
|
||||
这样的inputs被映射到了指令自己的属性。
|
||||
:marked
|
||||
If the name fails to match a property of a known directive or element, Angular reports an “unknown directive” error.
|
||||
|
|
Loading…
Reference in New Issue