diff --git a/public/docs/ts/latest/guide/dependency-injection.jade b/public/docs/ts/latest/guide/dependency-injection.jade index 1af8f3232d..50e0a7de15 100644 --- a/public/docs/ts/latest/guide/dependency-injection.jade +++ b/public/docs/ts/latest/guide/dependency-injection.jade @@ -139,7 +139,7 @@ include ../_util-fns :marked We also leverage TypeScript's constructor syntax for declaring parameters and properties simultaneously. - 我们同时借助TypeScript的构造器语法来同时定义参数和属性。 + 我们再次借助TypeScript的构造器语法来同时定义参数和属性。 // #docregion why-3-2 :marked Now we create a car by passing the engine and tires to the constructor. @@ -503,7 +503,7 @@ include ../_util-fns That's how the Angular injector knows to inject an instance of the `HeroService` when it creates a new `HeroListComponent`. - Angular的注入器是怎么知道在创建`HeroListComponent`时注入一个`HeroService`的实例的?这就是原理。 + Angular的注入器是怎么知道在创建`HeroListComponent`时该注入一个`HeroService`的实例的?这就是原因。 // #docregion di-create-injector-implicitly-1 :marked @@ -560,7 +560,7 @@ include ../_util-fns Listing dependencies as constructor parameters may be all we need to test application parts effectively. 我们前面强调过,设计一个适合依赖注入的类,可以让这个类更容易测试。 - 要有效的测试应用的一部分,所有我们所需要做的,就只是在构造函数的参数中列出依赖。 + 要有效的测试应用中的一部分,需要我们做的一切,就只是在构造函数的参数中列出依赖。 For example, we can create a new `HeroListComponent` with a mock service that we can manipulate under test: @@ -594,7 +594,7 @@ include ../_util-fns Here is the revision compared to the original. - 下面是在原来的类的基础上做的修改: + 下面是在原始类的基础上所做的修改: // #enddocregion di-service-service-1 +makeTabs( `dependency-injection/ts/app/heroes/hero.service.2.ts, @@ -766,7 +766,7 @@ code-example(format, language="html"). Our `HeroService` currently requires a `Logger`. What if we could get by without a logger? We'd use it if we had it, ignore it if we didn't. We can do that. - 我们的`HeroService`目前需要`Logger`。如果我们在没有日志服务的时候可以照样继续工作? + 我们的`HeroService`目前需要`Logger`。如果我们希望在没有日志服务的时候照样可以继续工作呢? 我们有它就用,没它就忽略。这也好办。 // #enddocregion logger-service-4 @@ -1142,7 +1142,7 @@ code-example(format, language="html"). `deps`属性是一个[供应商令牌](#token)数组。 `Logger`和`UserService`类作为它们自身供应商的令牌。 - 注入器解析这些令牌,并且把相应的服务注入到工厂函数参数中所对应的参数中去。 + 注入器解析这些令牌,并且把相应的服务注入到工厂函数中相应的参数中去。 // #enddocregion providers-factory-4 // #docregion providers-factory-5 - var lang = current.path[1] @@ -1365,8 +1365,8 @@ p 解决方案是定义和使用用一个!{opaquetoken}(不透明的令牌) We rarely work directly with an injector. Here's an `InjectorComponent` that does. - 我们很少直接使用注入器工作。 - 这里的`InjectorComponent`直接使用了注入器。 + 这里的`InjectorComponent`直接使用了注入器, + 但我们很少直接使用注入器工作。 // #enddocregion appendix-explicit-injector-1 +makeExample('dependency-injection/ts/app/injector.component.ts', 'injector', 'app/injector.component.ts') // #docregion appendix-explicit-injector-2 diff --git a/public/docs/ts/latest/guide/displaying-data.jade b/public/docs/ts/latest/guide/displaying-data.jade index 59f566f5d4..2ccced17d9 100644 --- a/public/docs/ts/latest/guide/displaying-data.jade +++ b/public/docs/ts/latest/guide/displaying-data.jade @@ -77,7 +77,7 @@ include ../_quickstart_repo much more readable HTML. 模板是包在反引号(\`)中的一个多行字符串。 - 反引号(\`) —— 不是单引号(') —— 有很多好用的特性。我们在这里用到的是它把一个字符串写在多行上的能力,这样我们的HTML模板更易于阅读。 + 反引号(\`) —— 不是单引号(') —— 有很多好用的特性。我们在这里用到的是它把一个字符串写在多行上的能力,这样我们的HTML模板就会更容易阅读。 :marked Angular automatically pulls the value of the `title` and `myHero` properties from the component and @@ -104,7 +104,7 @@ include ../_quickstart_repo Remember back in QuickStart that we added the `` element to the body of our `index.html` 注意`@Component`装饰器中指定的CSS选择器`selector`,它指定了一个叫`my-app`的元素。 - 回忆下,在快速开始章节中,我们曾把一个``元素添加到`index.html`的`body`里。 + 回忆下,在“快速开始”一章中,我们曾把一个``元素添加到`index.html`的`body`里。 +makeExample('displaying-data/ts/index.html', 'my-app')(format=".") :marked diff --git a/public/docs/ts/latest/guide/forms.jade b/public/docs/ts/latest/guide/forms.jade index 5f6580bed3..683656a8b5 100644 --- a/public/docs/ts/latest/guide/forms.jade +++ b/public/docs/ts/latest/guide/forms.jade @@ -36,7 +36,7 @@ include ../_util-fns - two-way data binding with `[(ngModel)]` syntax for reading and writing values to input controls - - 使用`[(ngModel)]`语法实现双向数据绑定,以便输入控件的值读取和写入 + - 使用`[(ngModel)]`语法实现双向数据绑定,以便于读取和写入输入控件的值 - using `ngControl` to track the change state and validity of form controls @@ -98,7 +98,7 @@ figure.image-display Here at the *Hero Employment Agency* we use this form to maintain personal information about the heroes in our stable. Every hero needs a job. It's our company mission to match the right hero with the right crisis! - 这里是*英雄职介中心*,我们使用这个表单来维护我们候选英雄们的个人信息。每个英雄都需要一份工作。我们公司的任务就是让正确的英雄去解决他/她所擅长对付的危机! + 这里是*英雄职介中心*,我们使用这个表单来维护我们候选英雄们的个人信息。每个英雄都需要一份工作。我们公司的任务就是让正确的英雄去解决他/她所擅长应对的危机! Two of the three fields on this form are required. Required fields have a green bar on the left to make them easy to spot. @@ -286,7 +286,7 @@ code-example(format=""). write (or read) large stretches of HTML and few editors are much help with files that have a mix of HTML and code. We also like short files with a clear and obvious purpose like this one. - 没有什么答案在所有场合都总是“正确”的。当行内联模板足够短的时候,我们喜欢用它。 + 没有什么答案在所有场合都总是“正确”的。当内联模板足够短的时候,我们更喜欢用它。 但大多数的表单模板都不短。普遍来讲,TypeScript和JavaScript文件不会是写大型HTML的好地方(也不好读)。 而且没有几个编辑器能对混写的HTML和代码提供足够的帮助。 我们还是喜欢写成像这个一样清晰明确的短文件。