diff --git a/aio/tools/translator/dict-1.json b/aio/tools/translator/dict-1.json
index 1a6307fc61..d48341365e 100644
--- a/aio/tools/translator/dict-1.json
+++ b/aio/tools/translator/dict-1.json
@@ -1825,7 +1825,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md"
},
{
- "original": "and run `npm install` on it.",
+ "original": "The following instructions presuppose that you have downloaded the\n Tour of Heroes' zip\n and run `npm install` on it.",
"translation": "下列步骤假设你已经下载了《英雄指南》的zip包,并且在其中运行过了`npm install`。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md"
},
@@ -1865,7 +1865,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md"
},
{
- "original": "tool can be quite revealing.",
+ "original": "It's fascinating to see what the generated JavaScript bundle looks like after Rollup.\nThe code is minified, so you won't learn much from inspecting the bundle directly.\nBut the source-map-explorer\ntool can be quite revealing.",
"translation": "看看Rollup之后生成的JavaScript包,非常神奇。\n代码已经被最小化,所以你不会从中直接学到任何知识。\n但是source-map-explorer 工具非常有用。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md"
},
@@ -1945,7 +1945,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md"
},
{
- "original": "Learn more about decorators on the web.",
+ "original": "Decorators are functions that modify JavaScript classes.\n Angular has many decorators that attach metadata to classes so that it knows\n what those classes mean and how they should work.\n \n Learn more about decorators on the web.",
"translation": "装饰器是用来修饰 JavaScript 类的函数。\nAngular 有很多装饰器,它们负责把元数据附加到类上,以了解那些类的设计意图以及它们应如何工作。\n关于装饰器的更多信息。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md"
},
@@ -2014,11 +2014,6 @@
"translation": "JavaScript 中,每个_文件_是一个模块,文件中定义的所有对象都从属于那个模块。\n通过`export`关键字,模块可以把它的某些对象声明为公共的。\n其它 JavaScript 模块可以使用*import 语句*来访问这些公共对象。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md"
},
- {
- "original": "Learn more about the JavaScript module system on the web.",
- "translation": "学习更多关于 JavaScript 模块的知识。",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md"
- },
{
"original": "These are two different and _complementary_ module systems. Use them both to write your apps.",
"translation": "这两个模块化系统是互补的,我们在写程序时都会用到。",
@@ -2151,7 +2146,7 @@
},
{
"original": "Metadata tells Angular how to process a class.",
- "translation": "元数据告诉 Angular 如何处理一个类。",
+ "translation": "
元数据告诉 Angular 如何处理一个类。
",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md"
},
{
@@ -2824,11 +2819,6 @@
"translation": "运行应用,就会看到我们的指令确实高亮了段落中的文本。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/attribute-directives.md"
},
- {
- "original": "Your directive isn't working?",
- "translation": "### 你的指令没生效?",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/attribute-directives.md"
- },
{
"original": "Did you remember to add the directive to the `declarations` attribute of `@NgModule`?\nIt is easy to forget!",
"translation": "你记着设置`@NgModule`的`declarations`数组了吗?它很容易被忘掉。",
@@ -3499,21 +3489,6 @@
"translation": "如果你使用下列已废弃的i18n管道:\n [date](api/common/DeprecatedDatePipe)、[currency](api/common/DeprecatedCurrencyPipe)、[decimal](api/common/DeprecatedDecimalPipe) 和 [percent](api/common/DeprecatedPercentPipe)",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
},
- {
- "original": "All but Chrome, Firefox, Edge, IE11 and Safari 10",
- "translation": "除了 Chrome、Firefox、Edge、IE11 和 Safari 10 外的所有浏览器",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
- },
- {
- "original": "[NgClass](api/common/NgClass) on SVG elements",
- "translation": "在 SVG 元素上应用 [NgClass](api/common/NgClass)",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
- },
- {
- "original": "[Http](guide/http) when sending and receiving binary data",
- "translation": "用 [Http](guide/http) 发送和接收二进制数据",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
- },
{
"original": "### Suggested polyfills ##",
"translation": "### 建议的填充库 ##\nBelow are the polyfills which are used to test the framework itself. They are a good starting point for an application.",
@@ -3541,12 +3516,7 @@
},
{
"original": "\\* Figures are for minified and gzipped code, \ncomputed with the closure compiler.",
- "translation": "\\* 这些指标测量的是最小化 (minify) 并且 gzip 过的代码,使用",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
- },
- {
- "original": "closure compiler",
- "translation": "计算出的结果。",
+ "translation": "\\* 这些指标测量的是最小化 (minify) 并且 gzip 过的代码,使用 closure compiler\n计算出的结果。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
},
{
@@ -3610,7 +3580,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md"
},
{
- "original": "the QuickStart repo update instructions.",
+ "original": "All samples now have a `src/` folder at the project root.\nThe former `app/` folder moves under `src/`.\nRead about moving your existing project to this structure in\n\nthe QuickStart repo update instructions.",
"translation": "我们已经把所有范例改成了使用项目根目录下的`src/`文件夹。\n也就是把以前的`app/`文件夹移到了`src/`文件夹下面。\n要了解如何对你的现有工程进行这种迁移,请参阅QuickStart中的迁移指南。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md"
},
@@ -3835,7 +3805,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md"
},
{
- "original": "in the `in-memory-web-api` repo.",
+ "original": "This change supports ES6 developers and aligns better with typical Angular libraries.\nIt does not affect the module's API but it does affect how you load and import it.\nSee the change note\nin the `in-memory-web-api` repo.",
"translation": "这个变化支持ES6开发者,并与典型的Angular库看齐。\n它不会影响模块的API,但是它改变了加载和导入它的方式。\n参见`in-memory-web-api`库的变更记录。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md"
},
@@ -3964,71 +3934,6 @@
"translation": "[生命周期钩子](guide/lifecycle-hooks)章现在更加简短,并且对强调了Angular是以什么顺序来调用钩子方法的。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md"
},
- {
- "original": "Cheat Sheet",
- "translation": "速查表",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Bootstrapping",
- "translation": "启动",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Template syntax",
- "translation": "模板语法",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Built-in directives",
- "translation": "内置指令",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Forms",
- "translation": "表单",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Class decorators",
- "translation": "类装饰器(decorator)",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Directive configuration",
- "translation": "指令配置",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Does not support parent-child relationship selectors.",
- "translation": "但不支持指定父子关系的选择器。",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Component configuration",
- "translation": "组件配置",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Class field decorators for directives and components",
- "translation": "给指令或组件类用的属性装饰器",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Directive and component change detection and lifecycle hooks",
- "translation": "指令和组件的变更检测与生命周期钩子",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Dependency injection configuration",
- "translation": "依赖注入的配置",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
- {
- "original": "Routing and navigation",
- "translation": "路由与导航",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md"
- },
{
"original": "# Component Interaction",
"translation": "# 组件之间的交互",
@@ -4104,11 +4009,6 @@
"translation": "运行应用程序会显示三个英雄:",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
},
- {
- "original": "Test it",
- "translation": "### 测试",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
- },
{
"original": "E2E test that all children were instantiated and displayed as expected:",
"translation": "端到端测试,用于确保所有的子组件都像所期待的那样被初始化并显示出来。",
@@ -4139,11 +4039,6 @@
"translation": "下面的`NameParentComponent`展示了各种名字的处理方式,包括一个全是空格的名字。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
},
- {
- "original": "Test it",
- "translation": "### 测试",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
- },
{
"original": "E2E tests of input property setter with empty and non-empty names:",
"translation": "端到端测试:输入属性的setter,分别使用空名字和非空名字。",
@@ -4189,11 +4084,6 @@
"translation": "下面是点击按钮的结果。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
},
- {
- "original": "Test it",
- "translation": "### 测试",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
- },
{
"original": "Test that ***both*** input properties are set initially and that button clicks trigger \nthe expected `ngOnChanges` calls and values:",
"translation": "测试确保***这两个***输入属性值都被初始化了,当点击按钮后,`ngOnChanges`应该被调用,属性的值也符合预期。",
@@ -4234,11 +4124,6 @@
"translation": "框架(Angular)把事件参数(用`$event`表示)传给事件处理方法,这个方法会处理:",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
},
- {
- "original": "Test it",
- "translation": "### 测试",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
- },
{
"original": "Test that clicking the *Agree* and *Disagree* buttons update the appropriate counters:",
"translation": "测试确保点击*Agree*和*Disagree*按钮时,计数器被正确更新。",
@@ -4289,11 +4174,6 @@
"translation": "下面是父组件和子组件一起工作时的效果。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
},
- {
- "original": "Test it",
- "translation": "### 测试",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
- },
{
"original": "Test that the seconds displayed in the parent template\nmatch the seconds displayed in the child's status message.\nTest also that clicking the *Stop* button pauses the countdown timer:",
"translation": "测试确保在父组件模板中显示的秒数和子组件状态信息里的秒数同步。它还会点击*Stop*按钮来停止倒计时:",
@@ -4379,11 +4259,6 @@
"translation": "使用`setTimeout()`来等下一轮,然后改写`seconds()`方法,这样它接下来就会从注入的这个计时器组件里获取秒数的值。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
},
- {
- "original": "Test it",
- "translation": "测试一下!",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
- },
{
"original": "Use [the same countdown timer tests](guide/component-interaction#countdown-tests) as before.",
"translation": "使用和之前[一样的倒计时测试](guide/component-interaction#countdown-tests)。",
@@ -4439,11 +4314,6 @@
"translation": "*History*日志证明了:在父组件`MissionControlComponent`和子组件`AstronautComponent`之间,信息通过该服务实现了双向传递。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
},
- {
- "original": "Test it",
- "translation": "### 测试",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md"
- },
{
"original": "Tests click buttons of both the parent `MissionControlComponent` and the `AstronautComponent` children\nand verify that the history meets expectations:",
"translation": "测试确保点击父组件`MissionControlComponent`和子组件`AstronautComponent`两个的组件的按钮时,*History*日志和预期的一样。",
@@ -7350,8 +7220,8 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md"
},
{
- "original": "Angular Ahead-of-Time Webpack Plugin.\nThis plugin transpiles the TypeScript application code,\nbundles lazy loaded `NgModules` separately,\nand performs AOT compilation — without any changes to the source code.",
- "translation": "考虑使用官方的",
+ "original": "Consider configuring _Webpack_ with the official\n\nAngular Ahead-of-Time Webpack Plugin.\nThis plugin transpiles the TypeScript application code,\nbundles lazy loaded `NgModules` separately,\nand performs AOT compilation — without any changes to the source code.",
+ "translation": "考虑使用官方的\nAngular预编译插件来配置*Webpack*。\n这个插件会转译TypeScript代码、独立打包延迟加载的`NgModules`,而且不用对源码做任何修改就能执行AOT编译。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md"
},
{
@@ -7370,7 +7240,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md"
},
{
- "original": "this post by rollup-creator, Rich Harris.",
+ "original": "Tree shaking was popularized by\nRollup, a popular tool with an ecosystem of\nplugins for bundling, minification, and uglification.\nLearn more about tree shaking and dead code elmination in\n\nthis post by rollup-creator, Rich Harris.",
"translation": "常用的摇树优化工具是Rollup,一个带有查件的生态系统,可以完成打包、最小化和混淆。\n要了解关于摇树优化和消除死代码技术的更多知识,参见这个帖子,它的作者就是rollup之父Rich Harris。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md"
},
@@ -7404,6 +7274,11 @@
"translation": "如果我们能对“是什么导致了应用变慢”的问题有一个清晰、准确的理解,那就可以对优化什么、如何优化做出更好地决策了。\n真正的原因可能并不是你所想的那样。\n我们可能花费大量的时间和金钱去优化一些东西,但它却无法产生可感知的效果甚至让应用变得更慢。\n我们应该在那些最重要的环境中实际运行,来度量应用的实际行为。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md"
},
+ {
+ "original": "The\n\nChrome DevTools Network Performance page is a good place to start learning about measuring performance.",
+ "translation": "\n Chrome开发工具的网络性能页是开始学习度量性能的好地方。",
+ "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md"
+ },
{
"original": "The [WebPageTest](https://www.webpagetest.org/) tool is another good choice\nthat can also help verify that your deployment was successful.",
"translation": "[WebPageTest](https://www.webpagetest.org/)工具是另一个不错的选择,它能帮你验证你的部署是否成功了。",
@@ -7614,6 +7489,11 @@
"translation": "### 请求来自另一个服务器的服务(CORS)",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md"
},
+ {
+ "original": "Angular developers may encounter a\n\ncross-origin resource sharing error when making a service request (typically a data service request).\nto a server other than the application's own host server.\nBrowsers forbid such requests unless the server permits them explicitly.",
+ "translation": "Angular开发者在向与该应用的宿主服务器不同域的服务器发起请求时,可能会遇到一种跨域资源共享(CORS)错误。\n浏览器会阻止该请求,除非得到那台服务器的明确许可。",
+ "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md"
+ },
{
"original": "There isn't anything the client application can do about these errors.\nThe server must be configured to accept the application's requests.\nRead about how to enable CORS for specific servers at\nenable-cors.org.",
"translation": "客户端应用对这种错误无能为力。\n服务器必须配置成可以接受来自该应用的请求。\n要了解如何对特定的服务器开启CORS,参见enable-cors.org。",
@@ -11755,7 +11635,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md"
},
{
- "original": "that derives from the\nCommon Locale Data Repository (CLDR),\nwhich specifies the\npluralization rules.",
+ "original": "This syntax conforms to the\nICU Message Format\nthat derives from the\nCommon Locale Data Repository (CLDR),\nwhich specifies the\npluralization rules.",
"translation": "这个写法符合ICU消息格式,它源自通用区域设置数据库(CLDR),其中指定了复数规则。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md"
},
@@ -12075,8 +11955,8 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md"
},
{
- "original": "(`es` or `en-US` for instance).",
- "translation": "目标",
+ "original": "* The _Locale ID_\n (`es` or `en-US` for instance).",
+ "translation": "目标_语言环境ID_\n (例如`es`或`en-US`)",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md"
},
{
@@ -13744,11 +13624,6 @@
"translation": "更一般地说,[优先把提供商注册进模块中](guide/ngmodule-faq#q-component-or-module),而不是组件中。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md"
},
- {
- "original": "Discussion",
- "translation": "讨论",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md"
- },
{
"original": "Angular registers all startup module providers with the application root injector.\nThe services created from root injector providers are available to the entire application.\nThey are _application-scoped_.",
"translation": "Angular把所有启动期模块的提供商都注册进了应用的根注入器中。\n这些服务是由根注入器中的提供商创建的,并且在整个应用中都可用。\n它们具有*应用级作用域*。",
@@ -13845,7 +13720,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md"
},
{
- "original": "",
+ "original": "To demonstrate, run the live example.\nModify the `SharedModule` so that it provides the `UserService` rather than the `CoreModule`.\nThen toggle between the \"Contact\" and \"Heroes\" links a few times.\nThe username goes bonkers as the Angular creates a new `UserService` instance each time.\n",
"translation": "自己验证一下吧。\n运行这个在线例子。\n修改`SharedModule`,由它来提供`UserService`而不再由`CoreModule`。\n然后在“Contact”和“Heroes”链接之间切换几次。\n由于Angular每次都创建一个新的`UserService`实例,所以用户名变得不正常了。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md"
},
@@ -14605,7 +14480,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md"
},
{
- "original": "",
+ "original": "The NgModule is also special in another way.\nUnlike JavaScript modules, an NgModule can extend the _entire_ application with services\nby adding providers to the `@NgModule.providers` list.\n",
"translation": "Angular模块还有些别的特殊之处。\n不同于JavaScript模块,Angular模块可以通过把服务提供商添加到`@NgModule.providers`数组中来扩展*整个*应用提供的服务。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md"
},
@@ -15319,11 +15194,6 @@
"translation": "要解释这一点,我们可以再加入`ContactComponent`组件,它是一个表单组件,从 Angular 的`FormsModule`中导入了表单支持。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
- {
- "original": "Add the _ContactComponent_",
- "translation": "添加 _ContactComponent_",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
- },
{
"original": "[Angular forms](guide/forms) are a great way to manage user data entry.",
"translation": "[Angular 表单](guide/forms)是用来管理用户数据输入的最佳方式之一。",
@@ -15335,12 +15205,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
{
- "original": "Angular form styles",
- "translation": "### Angular 表单的风格",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
- },
- {
- "original": "",
+ "original": "You can write Angular form components in\ntemplate-driven or\n[reactive](guide/dynamic-form) style.\n",
"translation": "我们写 Angular 表单组件时,可以使用[_模板驱动式表单_](guide/forms),\n 也可以使用[_响应式表单_](guide/dynamic-form)。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
@@ -15389,11 +15254,6 @@
"translation": "退一步说,即使 Angular 有办法识别`ngModel`,`ContactComponent`也不会表现的像 Angular 表单,\n因为本组件表单的表单相关的特性(例如有效性验证)还不可用。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
- {
- "original": "Import the FormsModule",
- "translation": "导入 FormsModule",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
- },
{
"original": "Add the `FormsModule` to the `AppModule` metadata's `imports` list.",
"translation": "把`FormsModule`加到`AppModule`元数据中的`imports`列表中:",
@@ -15419,11 +15279,6 @@
"translation": "**永远不要再次声明属于其它模块的类。**",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
- {
- "original": "Declare the contact component, directive, and pipe",
- "translation": "### 声明联系人的组件、指令和管道",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
- },
{
"original": "The application won't compile until you declare the contact component, directive, and pipe.\nUpdate the `declarations` in the `AppModule` accordingly:",
"translation": "如果我们没有声明该联系人模块的组件、指令和管道,该应用就会失败。\n更新`AppModule`中的`declarations`元数据,就像这样:",
@@ -15444,11 +15299,6 @@
"translation": "这解决了在文件中使用指令_类型_时的冲突问题,但是还有另一个问题没有解决,我们将在[后面](guide/ngmodule#resolve-conflicts)讨论它。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
- {
- "original": "Provide the _ContactService_",
- "translation": "提供 _ContactService_",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
- },
{
"original": "The `ContactComponent` displays contacts retrieved by the `ContactService`,\nwhich Angular injects into its constructor.",
"translation": "`ContactComponent`显示从`ContactService`服务中获取的联系人信息,该服务是被 Angular 注入到组件的构造函数中的。",
@@ -15469,11 +15319,6 @@
"translation": "现在,`ContactService`服务就能被注入进该应用中的任何组件了,就像`UserService`一样。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
- {
- "original": "Application-scoped providers",
- "translation": "全应用范围的提供商",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
- },
{
"original": "The `ContactService` provider is _application_-scoped because Angular\n registers a module's `providers` with the application's *root injector*.",
"translation": "`ContactService`的提供商是_全应用_范围的,这是因为 Angular 使用该应用的**根注入器**注册模块的`providers`。",
@@ -15504,11 +15349,6 @@
"translation": "在[NgModule常见问题](guide/ngmodule-faq)页的[如何把服务的范围限制在一个模块中](guide/ngmodule-faq#q-component-scoped-providers)一节中可以了解更多。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
- {
- "original": "Run the app",
- "translation": "运行该应用",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
- },
{
"original": "Everything is in place to run the application with its contact editor.",
"translation": "一切就绪,可以运行该应用及其联系人编辑器了。",
@@ -15880,7 +15720,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
{
- "original": "",
+ "original": "Some file names bear a `.3` extension that indicates\na difference with prior or future versions.\nThe significant differences will be explained in due course.\n",
"translation": "有些文件名带有`.3`扩展名,用来和以前/以后的版本区分开。\n我们会在适当的时机解释它们的差异。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
@@ -16244,11 +16084,6 @@
"translation": "`CoreModule`_提供_了`UserService`。Angular 在该应用的根注入器中注册了它的提供商,\n导致这份`UserService`的实例在每个需要它的组件中都是可用的,无论那个组件时主动加载的还是惰性加载的。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
},
- {
- "original": "Why bother?",
- "translation": "没必要?",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
- },
{
"original": "This scenario is clearly contrived.\nThe app is too small to worry about a single service file and a tiny, one-time component.",
"translation": "这个场景设计的是有点生硬。\n该应用太小了,所以其实并不需要拆分出单独的服务文件和小型的、一次性的组件。",
@@ -16504,11 +16339,6 @@
"translation": "Node.js和npm是做Angular开发的基础。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md"
},
- {
- "original": "Get them now if they're not already installed on your machine.",
- "translation": "如果你的电脑上还没有装过,请立即获取它!",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md"
- },
{
"original": "**Verify that you are running node `v4.x.x` or higher and npm `3.x.x` or higher**\nby running the commands `node -v` and `npm -v` in a terminal/console window.\nOlder versions produce errors.",
"translation": "通过在终端/控制台窗口中运行`node -v`和`npm -v`命令,来**验证下你是否正在使用node `v4.x.x`和npm `3.x.x`**。\n 过老的版本有可能出现问题。",
@@ -16520,7 +16350,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md"
},
{
- "original": "file is installed with a comprehensive starter set of\npackages as specified in the `dependencies` and `devDependencies` sections.",
+ "original": "During [Setup](guide/setup), a package.json\nfile is installed with a comprehensive starter set of\npackages as specified in the `dependencies` and `devDependencies` sections.",
"translation": "我们在[搭建本地开发环境](guide/setup)一章中安装并解释了package.json文件的\n `dependencies`和`devDependencies`区中指定了一组适用于新手的综合依赖包。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md"
},
@@ -17049,11 +16879,6 @@
"translation": "Angular通过*变更检测*过程来查找绑定值的更改,并在每一次JavaScript事件之后运行:每次按键、鼠标移动、定时器以及服务器的响应。\n这可能会让变更检测显得很昂贵,但是Angular会尽可能降低变更检测的成本。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
},
- {
- "original": "No pipe",
- "translation": "无管道",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
- },
{
"original": "In the next example, the component uses the default, aggressive change detection strategy to monitor and update\nits display of every hero in the `heroes` array. Here's the template:",
"translation": "我们下一个例子中的组件使用默认的、激进(昂贵)的变更检测策略来检测和更新`heroes`数组中的每个英雄。下面是它的模板:",
@@ -17139,11 +16964,6 @@
"translation": "在继续往下走之前,我们先理解一下*纯*和*非纯*之间的区别,从*纯*管道开始。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
},
- {
- "original": "Pure pipes",
- "translation": "纯管道",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
- },
{
"original": "Angular executes a *pure pipe* only when it detects a *pure change* to the input value.\nA pure change is either a change to a primitive input value (`String`, `Number`, `Boolean`, `Symbol`)\nor a changed object reference (`Date`, `Array`, `Function`, `Object`).",
"translation": "Angular只有在它检测到输入值发生了*纯变更*时才会执行*纯管道*。\n ***纯变更***是指对原始类型值(`String`、`Number`、`Boolean`、`Symbol`)的更改,\n 或者对对象引用(`Date`、`Array`、`Function`、`Object`)的更改。",
@@ -17169,11 +16989,6 @@
"translation": "或者我们也可以完全不用管道。\n有时候,使用组件的属性能比用管道更好的达到目的,这一点我们等后面会再提起。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
},
- {
- "original": "Impure pipes",
- "translation": "### 非纯管道",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
- },
{
"original": "Angular executes an *impure pipe* during every component change detection cycle.\nAn impure pipe is called often, as often as every keystroke or mouse-move.",
"translation": "Angular会在每个组件的变更检测周期中执行*非纯管道*。\n非纯管道可能会被调用很多次,和每个按键或每次鼠标移动一样频繁。",
@@ -17184,11 +16999,6 @@
"translation": "要在脑子里绷着这根弦,我们必须小心翼翼的实现非纯管道。\n一个昂贵、迟钝的管道将摧毁用户体验。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
},
- {
- "original": "An impure FlyingHeroesPipe",
- "translation": "### 非纯版本的*FlyingHeroesPipe*",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
- },
{
"original": "A flip of the switch turns the `FlyingHeroesPipe` into a `FlyingHeroesImpurePipe`.\nThe complete implementation is as follows:",
"translation": "我们把`FlyingHeroesPipe`换成了`FlyingHeroesImpurePipe`。\n下面是完整的实现:",
@@ -17234,11 +17044,6 @@
"translation": "这个Async管道节省了组件的样板代码。\n组件不用订阅这个异步数据源,而且不用在被销毁时取消订阅(如果订阅了而忘了反订阅容易导致隐晦的内存泄露)。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
},
- {
- "original": "An impure caching pipe",
- "translation": "一个非纯而且带缓存的管道",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
- },
{
"original": "Write one more impure pipe, a pipe that makes an HTTP request.",
"translation": "我们来写更多的非纯管道:一个向服务器发起HTTP请求的管道。",
@@ -17299,11 +17104,6 @@
"translation": "[JsonPipe](api/common/JsonPipe)为你诊断数据绑定的某些神秘错误或为做进一步绑定而探查数据时,提供了一个简单途径。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
},
- {
- "original": "Pure pipes and pure functions",
- "translation": "### 纯管道与纯函数",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
- },
{
"original": "A pure pipe uses pure functions.\nPure functions process inputs and return values without detectable side effects.\nGiven the same input, they should always return the same output.",
"translation": "纯管道使用纯函数。\n纯函数是指在处理输入并返回结果时,不会产生任何副作用的函数。\n给定相同的输入,它们总是返回相同的输出。",
@@ -17405,7 +17205,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md"
},
{
- "original": "download the example.",
+ "original": "And you can also download the example.",
"translation": "你还可以 下载这个例子 。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md"
},
@@ -19595,7 +19395,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md"
},
{
- "original": "for navigation. Thanks to `pushState`, you can make in-app URL paths look the way you want them to\nlook, e.g. `localhost:3000/crisis-center`. The in-app URLs can be indistinguishable from server URLs.",
+ "original": "The router uses the browser's\nhistory.pushState\nfor navigation. Thanks to `pushState`, you can make in-app URL paths look the way you want them to\nlook, e.g. `localhost:3000/crisis-center`. The in-app URLs can be indistinguishable from server URLs.",
"translation": "路由器使用浏览器的history.pushState进行导航。\n感谢`pushState`!有了它,我们就能按所期望的样子来显示应用内部的URL路径,比如:`localhost:3000/crisis-center`。虽然我们使用的全部是客户端合成的视图,但应用内部的这些URL看起来和来自服务器的没有什么不同。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md"
},
@@ -22770,12 +22570,12 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md"
},
{
- "original": "style by default, you *must* configure that strategy with a **base href**.",
+ "original": "While the router uses the \nHTML5 pushState\nstyle by default, you *must* configure that strategy with a **base href**.",
"translation": "由于路由器默认使用“HTML 5 pushState”风格,所以我们*必须*用一个**base href**来配置该策略(Strategy)。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md"
},
{
- "original": "tag in the `` of the `index.html`.",
+ "original": "The preferred way to configure the strategy is to add a\n<base href> element\ntag in the `` of the `index.html`.",
"translation": "配置该策略的首选方式是往`index.html`的``中添加一个[<base href> element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)标签。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md"
},
@@ -23240,7 +23040,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/setup-systemjs-anatomy.md"
},
{
- "original": "e2e test runner.",
+ "original": "_End-to-end_ (e2e) tests of the application,\n written in Jasmine and run by the\n protractor\n e2e test runner.",
"translation": "应用的*端对端*(e2e)测试,用 Jasmine 写成并用 protractor 端对端测试运行器测试。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/setup-systemjs-anatomy.md"
},
@@ -23290,12 +23090,12 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/setup-systemjs-anatomy.md"
},
{
- "original": "test runner described in the [Testing](guide/testing) guide.",
+ "original": "Configuration for the karma\n test runner described in the [Testing](guide/testing) guide.",
"translation": "在[测试](guide/testing)指南中提到的 karma 测试运行器的配置。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/setup-systemjs-anatomy.md"
},
{
- "original": "with SystemJS as described in the [Testing](guide/testing) guide.",
+ "original": "Script to run karma\n with SystemJS as described in the [Testing](guide/testing) guide.",
"translation": "在[测试](guide/testing)指南中提到的 karma 测试运行器的脚本。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/setup-systemjs-anatomy.md"
},
@@ -23320,7 +23120,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/setup-systemjs-anatomy.md"
},
{
- "original": "_end-to-end_ (e2e) test runner.",
+ "original": "Configuration for the\n protractor\n _end-to-end_ (e2e) test runner.",
"translation": "protractor *端对端* (e2e) 测试器运行器的配置。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/setup-systemjs-anatomy.md"
},
@@ -23404,11 +23204,6 @@
"translation": "## 下载",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/setup.md"
},
- {
- "original": "and unzip it into your project folder. Then perform the remaining steps with these terminal commands.",
- "translation": "下载《快速上手》种子",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/setup.md"
- },
{
"original": "`npm start` fails in _Bash for Windows_ in versions earlier than the Creator's Update (April 2017).",
"translation": "在*Bash for Windows*中`npm start`可能会失败,因为到2017-01为止它还不支持访问网络上的服务器。",
@@ -24340,8 +24135,8 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
{
- "original": "to all components, services, and other symbols.\nThis helps make the app cleaner, easier to read and maintain, and more testable.",
- "translation": "对所有的组件、服务等等应用",
+ "original": "Apply the\nsingle responsibility principle (SRP)\nto all components, services, and other symbols.\nThis helps make the app cleaner, easier to read and maintain, and more testable.",
+ "translation": "对所有的组件、服务等等应用单一职责原则 (SRP)",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
{
@@ -24399,11 +24194,6 @@
"translation": "随着应用程序的成长,本法则会变得越来越重要。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Small functions",
"translation": "### 小函数",
@@ -24449,11 +24239,6 @@
"translation": "**为何?**简单函数可避免易在大函数中产生的隐蔽性错误,例如与外界共享变量、创建意外的闭包或与依赖之间产生意外耦合等。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "## Naming",
"translation": "## 命名",
@@ -24499,11 +24284,6 @@
"translation": "**为何?**目录名和文件名应该清楚的传递它们的意图。\n例如,`app/heroes/hero-list.component.ts`包含了一个用来管理英雄列表的组件。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Separate file names with dots and dashes",
"translation": "### 使用点和横杠来分隔文件名",
@@ -24554,11 +24334,6 @@
"translation": "**为何?**为自动化任务提供模式匹配。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Symbols and file names",
"translation": "### 符号名与文件名",
@@ -24609,11 +24384,6 @@
"translation": "文件名",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Service names",
"translation": "### 服务名",
@@ -24664,11 +24434,6 @@
"translation": "文件名",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Bootstrapping",
"translation": "### 引导",
@@ -24704,11 +24469,6 @@
"translation": "**为何?**这是从其它技术平台借鉴的常用约定。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Directive selectors",
"translation": "### 指令选择器",
@@ -24734,11 +24494,6 @@
"translation": "**为何?**Angular HTML 解析器是大小写敏感的,它识别小写驼峰写法。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Custom prefix for components",
"translation": "### 为组件添加自定义前缀",
@@ -24809,11 +24564,6 @@
"translation": "**为何?**指令更加容易被识别。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Pipe names",
"translation": "### 管道名",
@@ -24844,11 +24594,6 @@
"translation": "文件名",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Unit test file names",
"translation": "### 单元测试文件名",
@@ -24904,11 +24649,6 @@
"translation": "管道",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### _End-to-End_ (E2E) test file names",
"translation": "### *端到端*(E2E)测试的文件名",
@@ -24949,11 +24689,6 @@
"translation": "端到端测试",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Angular _NgModule_ names",
"translation": "### Angular *NgModule* 命名",
@@ -25009,11 +24744,6 @@
"translation": "**为何?**`RoutingModule`是一种专门用来配置 Angular 路由器的模块。\n“类名和文件名保持一致”的约定使这些模块易于发现和验证。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "## Coding conventions",
"translation": "## 编程约定",
@@ -25049,11 +24779,6 @@
"translation": "**为何?**类可以被实例化和构造实例。根据约定,用大写驼峰命名法来标识可构造的东西。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Constants",
"translation": "### 常量",
@@ -25104,11 +24829,6 @@
"translation": "**为何?**传统的大写蛇形命名法仍然很流行、很普遍,特别是在第三方模块中。\n修改它们没多大价值,还会有破坏现有代码和文档的风险。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Interfaces",
"translation": "### 接口",
@@ -25135,7 +24855,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
{
- "original": "discourage the `I` prefix.",
+ "original": "**Why?** TypeScript guidelines\ndiscourage the `I` prefix.",
"translation": "**为何?**TypeScript 指导原则不建议使用 “I” 前缀。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
@@ -25154,11 +24874,6 @@
"translation": "**为何?**在 Angular 依赖注入系统中,接口类可以作为服务提供商的查找令牌。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Properties and methods",
"translation": "### 属性和方法",
@@ -25194,11 +24909,6 @@
"translation": "**为何?** TypeScript 工具让识别私有或公有属性和方法变得很简单。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Import line spacing",
"translation": "### 导入语句中的空行",
@@ -25234,11 +24944,6 @@
"translation": "**为何?**按字母顺序排列可以让阅读和定位本地导入更加容易。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "## Application structure and NgModules",
"translation": "## 应用程序结构与 Angular 模块",
@@ -25259,11 +24964,6 @@
"translation": "所有内容都遵循每个文件一个特性的原则。每个组件、服务和管道都在自己的文件里。\n所有第三方程序包保存到其它目录里,而不是`src`目录。\n你不会修改它们,所以不希望它们弄乱我们的应用程序。\n使用本指南介绍的文件命名约定。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "#### Style 04-01",
"translation": "#### 风格 04-01",
@@ -25284,11 +24984,6 @@
"translation": "**为何?**LIFT提供了一致的结构,它具有扩展性强、模块化的特性。因为容易快速锁定代码,提高了开发者的效率。\n另外,检查应用结构是否合理的方法是问问自己:我们能快速打开与此特性有关的所有文件并开始工作吗?",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Locate",
"translation": "### 定位",
@@ -25309,11 +25004,6 @@
"translation": "**为何?**\n要想高效的工作,就必须能迅速找到文件,特别是当不知道(或不记得)文件*名*时。\n把相关的文件一起放在一个直观的位置可以节省时间。\n富有描述性的目录结构会让你和后面的维护者眼前一亮。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Identify",
"translation": "### 识别",
@@ -25349,11 +25039,6 @@
"translation": "当你有一组小型、紧密相关的特性时,违反*一物一文件*的规则可能会更好,\n这种情况下单一文件可能会比多个文件更容易发现和理解。注意这个例外。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Flat",
"translation": "### 扁平",
@@ -25385,7 +25070,7 @@
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
{
- "original": "that humans start to struggle when the number of adjacent interesting things exceeds nine.\nSo when a folder has ten or more files, it may be time to create subfolders.",
+ "original": "On the other hand,\npsychologists believe\nthat humans start to struggle when the number of adjacent interesting things exceeds nine.\nSo when a folder has ten or more files, it may be time to create subfolders.",
"translation": "另一方面,心理学家们相信,\n当关注的事物超过 9 个时,人类就会开始感到吃力。\n所以,当一个文件夹中的文件有 10 个或更多个文件时,可能就是创建子目录的时候了。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
@@ -25394,11 +25079,6 @@
"translation": "还是根据你自己的舒适度而定吧。\n除非创建新文件夹能有显著的价值,否则尽量使用扁平结构。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### _T-DRY_ (Try to be _DRY_)",
"translation": "### *T-DRY*(尽量不重复自己)",
@@ -25424,11 +25104,6 @@
"translation": "**为何?**虽然 DRY 很重要,但如果要以牺牲 LIFT 的其它原则为代价,那就不值得了。\n这也就是为什么它被称为 *T-DRY*。\n例如,把组件命名为`hero-view.component.html`是多余的,因为带有`.html`扩展名的文件显然就是一个视图 (view)。\n但如果它不那么显著,或不符合常规,就把它写出来。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Overall structural guidelines",
"translation": "### 总体结构的指导原则",
@@ -25479,11 +25154,6 @@
"translation": "把组件放在专用目录中的方式广受欢迎,对于小型应用,还可以保持组件扁平化(而不是放在专用目录中)。\n这样会把四个文件放在现有目录中,也会减少目录的嵌套。无论你如何选择,请保持一致。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### _Folders-by-feature_ structure",
"translation": "### 按特性组织的目录结构",
@@ -25534,11 +25204,6 @@
"translation": "**为何?**Angular 模块隔离、测试和复用特性更容易。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### App _root module_",
"translation": "### 应用的*根模块*",
@@ -25569,11 +25234,6 @@
"translation": "**为何?**能让定位和识别根模块变得更容易。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Feature modules",
"translation": "### 特性模块",
@@ -25634,11 +25294,6 @@
"translation": "**为何?**特性模块易于隔离,以便测试。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Shared feature module",
"translation": "### 共享特性模块",
@@ -25709,11 +25364,6 @@
"translation": "**为何?**对于单例服务,你不希望每个模块都有自己的实例。\n而如果`SharedModule`提供了一个服务,那就有可能发生这种情况。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Core feature module",
"translation": "### 核心特性模块",
@@ -25804,11 +25454,6 @@
"translation": "`AppModule`变得更小了,因为很多应用根部的类都被移到了其它模块中。\n`AppModule`变得稳定了,因为你将会往其它模块中添加特性组件和服务提供商,而不是这个`AppModule`。\n`AppModule`把工作委托给了导入的模块,而不是亲力亲为。\n`AppModule`聚焦在它自己的主要任务上:作为整个应用的总指挥。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Prevent re-import of the core module",
"translation": "### 防止多次导入`CoreModule`",
@@ -25839,11 +25484,6 @@
"translation": "**为何?**守卫会禁止创建单例服务的多个实例。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Lazy Loaded folders",
"translation": "### 惰性加载的目录",
@@ -25869,11 +25509,6 @@
"translation": "**为何?**这种目录让标识和隔离这些特性内容变得更轻松。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Never directly import lazy loaded folders",
"translation": "### 永远不要直接导入惰性加载的目录",
@@ -25894,11 +25529,6 @@
"translation": "**为何?**直接导入并使用此模块会立即加载它,而原本的设计意图是按需加载它。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "## Components",
"translation": "## 组件",
@@ -25924,11 +25554,6 @@
"translation": "**为何?**保持元素命名与[自定义元素](https://www.w3.org/TR/custom-elements/)命名规范一致。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Components as elements",
"translation": "### 把组件当做元素",
@@ -25954,11 +25579,6 @@
"translation": "**为何?**查看组件模板的 HTML 时,更容易识别一个符号是组件还是指令。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Extract templates and styles to their own files",
"translation": "### 把模板和样式提取到它们自己的文件",
@@ -26009,11 +25629,6 @@
"translation": "**为何?**`./`前缀是相对URL的标准语法,不必依赖Angular的特殊处理,如果没有前缀则不行。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Decorate _input_ and _output_ properties",
"translation": "### 内联输入和输出属性装饰器",
@@ -26054,11 +25669,6 @@
"translation": "**为何?**把装饰器放到同一行可以精简代码,同时更易于识别输入或输出属性。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Avoid aliasing _inputs_ and _outputs_",
"translation": "### 避免为输入和输出属性指定别名",
@@ -26084,11 +25694,6 @@
"translation": "**为何?**如果指令名也同时用作*输入*属性,而且指令名无法准确描述这个属性的用途时,应该使用别名。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Member sequence",
"translation": "### 成员顺序",
@@ -26114,11 +25719,6 @@
"translation": "**为何?**把类的成员按照统一的顺序排列,易于阅读,能立即识别出组件的哪个成员服务于何种目的。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Delegate complex component logic to services",
"translation": "### 把逻辑放到服务里",
@@ -26159,11 +25759,6 @@
"translation": "**为何?**保持组件苗条、精简和聚焦。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Don't prefix _output_ properties",
"translation": "### 不要给输出属性加前缀",
@@ -26194,11 +25789,6 @@
"translation": "**为何?**Angular 允许[另一种备选语法](guide/template-syntax#binding-syntax) `on-*`。如果事件的名字本身带有前缀`on`,那么绑定的表达式可能是`on-onEvent`。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Put presentation logic in the component class",
"translation": "### 把表现层逻辑放到组件类里",
@@ -26224,11 +25814,6 @@
"translation": "**为何?**将组件的表现层逻辑放到组件类而非模板里,可以增强测试性、维护性和重复使用性。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "## Directives",
"translation": "## 指令",
@@ -26259,11 +25844,6 @@
"translation": "**为何?**一个元素可以使用多个属性型指令。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### _HostListener_/_HostBinding_ decorators versus _host_ metadata",
"translation": "### *HostListener* 和 *HostBinding* 装饰器 vs. 组件元数据 *host*",
@@ -26299,11 +25879,6 @@
"translation": "**为何?**`host`元数据只是一个便于记忆的名字而已,并不需要额外的 ES 导入。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "## Services",
"translation": "## 服务",
@@ -26334,11 +25909,6 @@
"translation": "**为何?**服务是共享状态性内存数据的理想载体。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Single responsibility",
"translation": "### 单一职责",
@@ -26369,11 +25939,6 @@
"translation": "**为何?**当某个服务有多个职责时,每个注入它的组件或服务都会承担这些职责的全部开销。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Providing a service",
"translation": "### 提供一个服务",
@@ -26404,11 +25969,6 @@
"translation": "**为何?**当不同的两个组件需要一个服务的不同的实例时,上面的方法这就不理想了。在这种情况下,对于需要崭新和单独服务实例的组件,最好在组件级提供服务。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Use the @Injectable() class decorator",
"translation": "### 使用 @Injectable() 类装饰器",
@@ -26434,11 +25994,6 @@
"translation": "**为何?**当服务只接受类型令牌相关的依赖时,比起在每个构造函数参数上使用`@Inject()`,`@Injectable()`的语法简洁多了。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "## Data Services",
"translation": "## 数据服务",
@@ -26484,11 +26039,6 @@
"translation": "数据服务应该封装这些细节。这样,在服务内部修改细节,就不会影响到它的消费者。并且更容易通过实现一个模拟服务来对消费者进行测试。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "## Lifecycle hooks",
"translation": "## 生命周期钩子",
@@ -26499,11 +26049,6 @@
"translation": "使用生命周期钩子来介入到 Angular 暴露的重要事件里。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### Implement lifecycle hook interfaces",
"translation": "### 实现生命周期钩子接口",
@@ -26524,11 +26069,6 @@
"translation": "**为何?**如果使用强类型的方法签名,编译器和编辑器可以帮你揪出拼写错误。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "## Appendix",
"translation": "## 附录",
@@ -26539,11 +26079,6 @@
"translation": "有用的 Angular 工具和小提示",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "#### Style A-01",
"translation": "#### 风格 A-01",
@@ -26559,11 +26094,6 @@
"translation": "**考虑**调整 codelyzer 的规则来满足你的需求。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "### File templates and snippets",
"translation": "### 文档模板和代码片段",
@@ -26599,11 +26129,6 @@
"translation": "**考虑**使用 [Vim](http://www.vim.org/) 的[代码片断](https://github.com/mhartington/vim-angular2-snippets)来实施本风格指南。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
},
- {
- "original": "Back to top",
- "translation": "回到顶部",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
- },
{
"original": "# Template Syntax",
"translation": "# 模板语法",
@@ -26729,16 +26254,6 @@
"translation": "赋值 (`=`, `+=`, `-=`, ...)",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
},
- {
- "original": "new",
- "translation": "`new`运算符",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
- },
- {
- "original": "; or ,",
- "translation": "使用`;`或`,`的链式表达式",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
- },
{
"original": "* increment and decrement operators (`++` and `--`)",
"translation": "自增或自减操作符 (`++`和`--`)",
@@ -26914,11 +26429,6 @@
"translation": "然而,某些 JavaScript 语法仍然是不允许的:",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
},
- {
- "original": "new",
- "translation": "`new`运算符",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
- },
{
"original": "* increment and decrement operators, `++` and `--`",
"translation": "自增和自减运算符:`++`和`--`",
@@ -27779,11 +27289,6 @@
"translation": "如果事件属于指令(回想一下,组件是指令的一种),那么`$event`具体是什么由指令决定。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
},
- {
- "original": "EventEmitter",
- "translation": "### 使用 EventEmitter 实现自定义事件",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
- },
{
"original": "Directives typically raise custom events with an Angular [EventEmitter](api/core/EventEmitter).\nThe directive creates an `EventEmitter` and exposes it as a property.\nThe directive calls `EventEmitter.emit(payload)` to fire an event, passing in a message payload, which can be anything.\nParent directives listen for the event by binding to this property and accessing the payload through the `$event` object.",
"translation": "通常,指令使用 Angular [EventEmitter](api/core/EventEmitter) 来触发自定义事件。\n指令创建一个`EventEmitter`实例,并且把它作为属性暴露出来。\n指令调用`EventEmitter.emit(payload)`来触发事件,可以传入任何东西作为消息载荷。\n父指令通过绑定到这个属性来监听事件,并通过`$event`对象来访问载荷。",
@@ -28039,11 +27544,6 @@
"translation": "你既可以在初始化时调用`setCurrentStyles()`,也可以在所依赖的属性变化时调用。",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
},
- {
- "original": "[(ngModel)]",
- "translation": "### NgModel - 使用[(ngModel)]双向绑定到表单元素",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
- },
{
"original": "When developing data entry forms, you often both display a data property and\nupdate that property when the user makes changes.",
"translation": "当开发数据输入表单时,我们通常都要既显示数据属性又根据用户的更改去修改那个属性。",
@@ -28069,11 +27569,6 @@
"translation": "导入`FormsModule`并让`[(ngModel)]`可用的代码如下:",
"sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
},
- {
- "original": "[(ngModel)]",
- "translation": "#### [(ngModel)]内幕",
- "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
- },
{
"original": "Looking back at the `name` binding, note that\nyou could have achieved the same result with separate bindings to\nthe `` element's `value` property and `input` event.",
"translation": "回头看看`name`绑定,注意,你可以通过分别绑定到``元素的`value`属性和`input`事件来达到同样的效果。",
@@ -28474,11 +27969,6 @@
"translation": "我们可以在模板中的任何地方引用模板引用变量。\n比如声明在``上的`phone`变量就是在模板另一侧的` or ,",
- "translation": "使用`;`或`,`的链式表达式",
- "sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
- },
{
"original": "* increment and decrement operators (`++` and `--`)",
"translation": "自增或自减操作符 (`++`和`--`)",
@@ -24094,11 +23649,6 @@
"translation": "然而,某些 JavaScript 语法仍然是不允许的:",
"sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
},
- {
- "original": "new",
- "translation": "`new`运算符",
- "sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
- },
{
"original": "* increment and decrement operators, `++` and `--`",
"translation": "自增和自减运算符:`++`和`--`",
@@ -24959,11 +24509,6 @@
"translation": "如果事件属于指令(回想一下,组件是指令的一种),那么`$event`具体是什么由指令决定。",
"sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
},
- {
- "original": "EventEmitter",
- "translation": "### 使用 EventEmitter 实现自定义事件",
- "sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
- },
{
"original": "Directives typically raise custom events with an Angular [EventEmitter](api/core/EventEmitter).\nThe directive creates an `EventEmitter` and exposes it as a property.\nThe directive calls `EventEmitter.emit(payload)` to fire an event, passing in a message payload, which can be anything.\nParent directives listen for the event by binding to this property and accessing the payload through the `$event` object.",
"translation": "通常,指令使用 Angular [EventEmitter](api/core/EventEmitter) 来触发自定义事件。\n指令创建一个`EventEmitter`实例,并且把它作为属性暴露出来。\n指令调用`EventEmitter.emit(payload)`来触发事件,可以传入任何东西作为消息载荷。\n父指令通过绑定到这个属性来监听事件,并通过`$event`对象来访问载荷。",
@@ -25219,11 +24764,6 @@
"translation": "你既可以在初始化时调用`setCurrentStyles()`,也可以在所依赖的属性变化时调用。",
"sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
},
- {
- "original": "[(ngModel)]",
- "translation": "### NgModel - 使用[(ngModel)]双向绑定到表单元素",
- "sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
- },
{
"original": "When developing data entry forms, you often both display a data property and\nupdate that property when the user makes changes.",
"translation": "当开发数据输入表单时,我们通常都要既显示数据属性又根据用户的更改去修改那个属性。",
@@ -25249,11 +24789,6 @@
"translation": "导入`FormsModule`并让`[(ngModel)]`可用的代码如下:",
"sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
},
- {
- "original": "[(ngModel)]",
- "translation": "#### [(ngModel)]内幕",
- "sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
- },
{
"original": "Looking back at the `name` binding, note that\nyou could have achieved the same result with separate bindings to\nthe `` element's `value` property and `input` event.",
"translation": "回头看看`name`绑定,注意,你可以通过分别绑定到``元素的`value`属性和`input`事件来达到同样的效果。",
@@ -25654,11 +25189,6 @@
"translation": "我们可以在模板中的任何地方引用模板引用变量。\n比如声明在``上的`phone`变量就是在模板另一侧的` or ,",
- "translation": "使用`;`或`,`的链式表达式",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
- },
{
"original": "* increment and decrement operators (`++` and `--`)",
"translation": "自增或自减操作符 (`++`和`--`)",
@@ -22049,11 +21619,6 @@
"translation": "然而,某些 JavaScript 语法仍然是不允许的:",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
},
- {
- "original": "new",
- "translation": "`new`运算符",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
- },
{
"original": "* increment and decrement operators, `++` and `--`",
"translation": "自增和自减运算符:`++`和`--`",
@@ -22924,11 +22489,6 @@
"translation": "如果事件属于指令(回想一下,组件是指令的一种),那么`$event`具体是什么由指令决定。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
},
- {
- "original": "EventEmitter",
- "translation": "### 使用 EventEmitter 实现自定义事件",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
- },
{
"original": "Directives typically raise custom events with an Angular [EventEmitter](api/core/EventEmitter).\nThe directive creates an `EventEmitter` and exposes it as a property.\nThe directive calls `EventEmitter.emit(payload)` to fire an event, passing in a message payload, which can be anything.\nParent directives listen for the event by binding to this property and accessing the payload through the `$event` object.",
"translation": "通常,指令使用 Angular [EventEmitter](api/core/EventEmitter) 来触发自定义事件。\n指令创建一个`EventEmitter`实例,并且把它作为属性暴露出来。\n指令调用`EventEmitter.emit(payload)`来触发事件,可以传入任何东西作为消息载荷。\n父指令通过绑定到这个属性来监听事件,并通过`$event`对象来访问载荷。",
@@ -23184,11 +22744,6 @@
"translation": "你既可以在初始化时调用`setCurrentStyles()`,也可以在所依赖的属性变化时调用。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
},
- {
- "original": "[(ngModel)]",
- "translation": "### NgModel - 使用[(ngModel)]双向绑定到表单元素",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
- },
{
"original": "When developing data entry forms, you often both display a data property and\nupdate that property when the user makes changes.",
"translation": "当开发数据输入表单时,我们通常都要既显示数据属性又根据用户的更改去修改那个属性。",
@@ -23214,11 +22769,6 @@
"translation": "导入`FormsModule`并让`[(ngModel)]`可用的代码如下:",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
},
- {
- "original": "[(ngModel)]",
- "translation": "#### [(ngModel)]内幕",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
- },
{
"original": "Looking back at the `name` binding, note that\nyou could have achieved the same result with separate bindings to\nthe `` element's `value` property and `input` event.",
"translation": "回头看看`name`绑定,注意,你可以通过分别绑定到``元素的`value`属性和`input`事件来达到同样的效果。",
@@ -23619,11 +23169,6 @@
"translation": "我们可以在模板中的任何地方引用模板引用变量。\n比如声明在``上的`phone`变量就是在模板另一侧的`