From 9ccc6de90f3c013cc9d07605be5b25cfe871177f Mon Sep 17 00:00:00 2001 From: Zhicheng WANG Date: Sat, 2 Feb 2019 02:37:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E5=AD=97=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/tools/translator/dict-latest.json | 53450 ------------------------ 1 file changed, 53450 deletions(-) delete mode 100644 aio/tools/translator/dict-latest.json diff --git a/aio/tools/translator/dict-latest.json b/aio/tools/translator/dict-latest.json deleted file mode 100644 index 222e3dd3df..0000000000 --- a/aio/tools/translator/dict-latest.json +++ /dev/null @@ -1,53450 +0,0 @@ -[ - { - "key": "##TRANSPILE", - "original": "## Transpile", - "translation": "## 转译(transpile)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" - }, - { - "key": "THEPROCESSOFTRANSFORMINGCODEWRITTENINONEFORMOFJAVASCRIPTSUCHASTYPESCRIPTINTOANOTHERFORMOFJAVASCRIPTSUCHASES5FRAGMENTSGLOSSARYT2#ES5", - "original": "The process of transforming code written in one form of JavaScript\n(such as TypeScript) into another form of JavaScript (such as [ES5](_fragments/glossary-t2#es5)).", - "translation": "把一种形式的 JavaScript(例如 TypeScript)转换成另一种形式的 JavaScript(例如 [ES5](_fragments/glossary-t2#es5))的过程。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" - }, - { - "key": "##TYPESCRIPT", - "original": "## TypeScript", - "translation": "## TypeScript 语言", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" - }, - { - "key": "AVERSIONOFJAVASCRIPTTHATSUPPORTSMOSTECMASCRIPT2015FRAGMENTSGLOSSARYT2#ES2015LANGUAGEFEATURESSUCHASDECORATORSFRAGMENTSGLOSSARYT2#DECORATOR", - "original": "A version of JavaScript that supports most [ECMAScript 2015](_fragments/glossary-t2#es2015)\nlanguage features such as [decorators](_fragments/glossary-t2#decorator).", - "translation": "JavaScript 的一个版本,支持了几乎所有 [ECMAScript 2015](_fragments/glossary-t2#ecmascript=2015) 语言特性,例如[装饰器 (decorator)](_fragments/glossary-t2#decorator))。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" - }, - { - "key": "TYPESCRIPTISALSONOTABLEFORITSOPTIONALTYPINGSYSTEMWHICHPROVIDESCOMPILETIMETYPECHECKINGANDSTRONGTOOLINGSUPPORTSUCHASINTELLISENSECODECOMPLETIONREFACTORINGANDINTELLIGENTSEARCHMANYCODEEDITORSANDIDESSUPPORTTYPESCRIPTEITHERNATIVELYORWITHPLUGINS", - "original": "TypeScript is also notable for its optional typing system, which provides\ncompile-time type checking and strong tooling support (such as \"intellisense,\"\ncode completion, refactoring, and intelligent search). Many code editors\nand IDEs support TypeScript either natively or with plugins.", - "translation": "TypeScript 还以它的可选类型系统而著称。\n该类型系统提供了编译时类型检查和强大的工具支持(例如 “Intellisense”,代码补齐,重构和智能搜索等)。\n许多代码编辑器和 IDE 都原生支持 TypeScript 或通过插件提供支持。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" - }, - { - "key": "TYPESCRIPTISTHEPREFERREDLANGUAGEFORANGULARDEVELOPMENTALTHOUGHYOUCANUSEOTHERJAVASCRIPTDIALECTSSUCHASES5FRAGMENTSGLOSSARYT2#ES5", - "original": "TypeScript is the preferred language for Angular development, although\nyou can use other JavaScript dialects such as [ES5](_fragments/glossary-t2#es5).", - "translation": "TypeScript 是 Angular 的首选语言,当然,你可以使用其它 JavaScript 方言,例如[ES5](_fragments/glossary-t2#es5)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" - }, - { - "key": "READMOREABOUTTYPESCRIPTATTYPESCRIPTLANGORGHTTP:WWWTYPESCRIPTLANGORG", - "original": "Read more about TypeScript at [typescriptlang.org](http://www.typescriptlang.org/).", - "translation": "更多信息,见[typescript.org](http://www.typescriptlang.org/)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" - }, - { - "key": "#ANGULARJSTOANGULARCONCEPTS:QUICKREFERENCE", - "original": "# AngularJS to Angular Concepts: Quick Reference", - "translation": "# 关于AngularJS 与 Angular 概念的快速参考", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARISTHENAMEFORTHEANGULAROFTODAYANDTOMORROWANGULARJSISTHENAMEFORALLV1XVERSIONSOFANGULAR", - "original": "_Angular_ is the name for the Angular of today and tomorrow.\n_AngularJS_ is the name for all v1.x versions of Angular.", - "translation": "*Angular* 这个名字专指现在和未来的 Angular 版本,而 *AngularJS* 专指 Angular 的所有 v1.x 版本。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THISGUIDEHELPSYOUTRANSITIONFROMANGULARJSTOANGULARBYMAPPINGANGULARJSSYNTAXTOTHEEQUIVALENTANGULARSYNTAX", - "original": "This guide helps you transition from AngularJS to Angular\nby mapping AngularJS syntax to the equivalent Angular syntax.", - "translation": "本章提供了一个快速的参考指南,指出一些常用的 AngularJS 语法及其在 Angular 中的等价物。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "SEETHEANGULARSYNTAXINTHISLIVEEXAMPLENAMEAJSQUICKREFERENCELIVEEXAMPLE", - "original": "**See the Angular syntax in this **.", - "translation": "**参见 以学习 Angular 语法**", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "##TEMPLATEBASICS", - "original": "## Template basics", - "translation": "## 模板基础", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "TEMPLATESARETHEUSERFACINGPARTOFANANGULARAPPLICATIONANDAREWRITTENINHTMLTHEFOLLOWINGTABLELISTSSOMEOFTHEKEYANGULARJSTEMPLATEFEATURESWITHTHEIREQUIVALENTANGULARTEMPLATESYNTAX", - "original": "Templates are the user-facing part of an Angular application and are written in HTML.\nThe following table lists some of the key AngularJS template features with their equivalent Angular template syntax.", - "translation": "模板是 Angular 应用中的门面部分,它是用 HTML 写的。下表中是一些 AngularJS 中的关键模板特性及其在 Angular 中的等价语法。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###BINDINGSINTERPOLATION", - "original": "### Bindings/interpolation", - "translation": "### 绑定/插值表达式", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSANEXPRESSIONINCURLYBRACESDENOTESONEWAYBINDINGTHISBINDSTHEVALUEOFTHEELEMENTTOAPROPERTYINTHECONTROLLERASSOCIATEDWITHTHISTEMPLATE", - "original": "In AngularJS, an expression in curly braces denotes one-way binding.\n This binds the value of the element to a property in the controller\n associated with this template.", - "translation": "在 AngularJS 中,花括号中的表达式代表单向绑定。\n 它把元素的值绑定到了与模板相关控制器的属性上。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "WHENUSINGTHECONTROLLERASSYNTAXTHEBINDINGISPREFIXEDWITHTHECONTROLLERALIASVMORCTRLBECAUSEYOUHAVETOBESPECIFICABOUTTHESOURCEOFTHEBINDING", - "original": "When using the `controller as` syntax,\n the binding is prefixed with the controller alias (`vm` or `$ctrl`) because you\n have to be specific about the source of the binding.", - "translation": "当使用 `controller as` 语法时,该绑定需要用控制器的别名(`vm`)为前缀,这是因为你不得不通过它来指定绑定源。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###BINDINGSINTERPOLATION", - "original": "### Bindings/interpolation", - "translation": "### 绑定/插值表达式", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARATEMPLATEEXPRESSIONINCURLYBRACESSTILLDENOTESONEWAYBINDINGTHISBINDSTHEVALUEOFTHEELEMENTTOAPROPERTYOFTHECOMPONENTTHECONTEXTOFTHEBINDINGISIMPLIEDANDISALWAYSTHEASSOCIATEDCOMPONENTSOITNEEDSNOREFERENCEVARIABLE", - "original": "In Angular, a template expression in curly braces still denotes one-way binding.\n This binds the value of the element to a property of the component.\n The context of the binding is implied and is always the\n associated component, so it needs no reference variable.", - "translation": "在 Angular 中,花括号中的模板表达式同样代表单向绑定。\n 它把元素的值绑定到了组件的属性上。\n 它绑定的上下文变量是隐式的,并且总是关联到组件。\n 所以,它不需要一个引用变量。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEETHEINTERPOLATIONGUIDETEMPLATESYNTAX#INTERPOLATIONSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information, see the [Interpolation](guide/template-syntax#interpolation)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解更多,请参见[模板语法](guide/template-syntax)中的[插值表达式](guide/template-syntax#interpolation)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###FILTERS", - "original": "### Filters", - "translation": "### 过滤器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "TOFILTEROUTPUTINANGULARJSTEMPLATESUSETHEPIPECHARACTERANDONEORMOREFILTERS", - "original": "To filter output in AngularJS templates, use the pipe character (|) and one or more filters.", - "translation": "要在 AngularJS 中过滤输出,使用管道字符(|)以及一个或多个过滤器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THISEXAMPLEFILTERSTHETITLEPROPERTYTOUPPERCASE", - "original": "This example filters the `title` property to uppercase.", - "translation": "这个例子中把 `title` 属性过滤成了大写形式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###PIPES", - "original": "### Pipes", - "translation": "### 管道", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARYOUUSESIMILARSYNTAXWITHTHEPIPECHARACTERTOFILTEROUTPUTBUTNOWYOUCALLTHEMPIPESMANYBUTNOTALLOFTHEBUILTINFILTERSFROMANGULARJSAREBUILTINPIPESINANGULAR", - "original": "In Angular you use similar syntax with the pipe (|) character to filter output, but now you call them **pipes**.\n Many (but not all) of the built-in filters from AngularJS are\n built-in pipes in Angular.", - "translation": "在 Angular 中,你使用类似的语法 —— 用管道字符(|)来过滤输出,但是现在直接把它叫做**管道**了。\n 很多(但不是所有)AngularJS 中的内置过滤器也成了 Angular 中的内置管道。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEEFILTERSPIPESGUIDEAJSQUICKREFERENCE#FILTERSPIPESBELOW", - "original": "For more information, see [Filters/pipes](guide/ajs-quick-reference#filters-pipes) below.", - "translation": "请参见下面[过滤器/管道](guide/ajs-quick-reference#filters-pipes)了解更多信息。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###LOCALVARIABLES", - "original": "### Local variables", - "translation": "### 局部变量", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "HEREMOVIEISAUSERDEFINEDLOCALVARIABLE", - "original": "Here, `movie` is a user-defined local variable.", - "translation": "这里的 `movie` 是一个用户定义的局部变量", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###INPUTVARIABLES", - "original": "### Input variables", - "translation": "### 输入变量", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARHASTRUETEMPLATEINPUTVARIABLESTHATAREEXPLICITLYDEFINEDUSINGTHELETKEYWORD", - "original": "Angular has true template input variables that are explicitly defined using the `let` keyword.", - "translation": "Angular 有了真正的模板输入变量,它需要使用 `let` 关键字进行明确定义。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEETHENGFORMICROSYNTAXGUIDETEMPLATESYNTAX#MICROSYNTAXSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information, see the [ngFor micro-syntax](guide/template-syntax#microsyntax)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解更多信息,请参见[模板语法](guide/template-syntax)中的[ngFor 微语法](guide/template-syntax#microsyntax)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "##TEMPLATEDIRECTIVES", - "original": "## Template directives", - "translation": "## 模板指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARJSPROVIDESMORETHANSEVENTYBUILTINDIRECTIVESFORTEMPLATESMANYOFTHEMARENTNEEDEDINANGULARBECAUSEOFITSMORECAPABLEANDEXPRESSIVEBINDINGSYSTEMTHEFOLLOWINGARESOMEOFTHEKEYANGULARJSBUILTINDIRECTIVESANDTHEIREQUIVALENTSINANGULAR", - "original": "AngularJS provides more than seventy built-in directives for templates.\nMany of them aren't needed in Angular because of its more capable and expressive binding system.\nThe following are some of the key AngularJS built-in directives and their equivalents in Angular.", - "translation": "AngularJS 为模板提供了七十多个内置指令。\n在 Angular 中,它们很多都已经不需要了,因为 Angular 有了一个更加强大、快捷的绑定系统。\n下面是一些 AngularJS 中的关键指令及其在 Angular 中的等价物。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THEAPPLICATIONSTARTUPPROCESSISCALLEDBOOTSTRAPPING", - "original": "The application startup process is called **bootstrapping**.", - "translation": "应用的启动过程被称为**引导**。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ALTHOUGHYOUCANBOOTSTRAPANANGULARJSAPPINCODEMANYAPPLICATIONSBOOTSTRAPDECLARATIVELYWITHTHENGAPPDIRECTIVEGIVINGITTHENAMEOFTHEAPPLICATIONSMODULEMOVIEHUNTER", - "original": "Although you can bootstrap an AngularJS app in code,\n many applications bootstrap declaratively with the `ng-app` directive,\n giving it the name of the application's module (`movieHunter`).", - "translation": "虽然可以从代码中引导 Angular 应用,\n 但很多应用都是通过 `ng-app` 指令进行声明式引导的,只要给它一个应用模块的名字(`movieHunter`)就可以了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###BOOTSTRAPPING", - "original": "### Bootstrapping", - "translation": "### 引导", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARDOESNTHAVEABOOTSTRAPDIRECTIVETOLAUNCHTHEAPPINCODEEXPLICITLYBOOTSTRAPTHEAPPLICATIONSROOTMODULEAPPMODULEINMAINTSANDTHEAPPLICATIONSROOTCOMPONENTAPPCOMPONENTINAPPMODULETS", - "original": "Angular doesn't have a bootstrap directive.\n To launch the app in code, explicitly bootstrap the application's root module (`AppModule`)\n in `main.ts`\n and the application's root component (`AppComponent`) in `app.module.ts`.", - "translation": "Angular 没有引导指令。\n 总是要通过显式调用一个 `bootstrap` 函数,并传入应用模块的名字(`AppComponent`)来启动应用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGCLASSDIRECTIVEINCLUDESEXCLUDESCSSCLASSESBASEDONANEXPRESSIONTHATEXPRESSIONISOFTENAKEYVALUECONTROLOBJECTWITHEACHKEYOFTHEOBJECTDEFINEDASACSSCLASSNAMEANDEACHVALUEDEFINEDASATEMPLATEEXPRESSIONTHATEVALUATESTOABOOLEANVALUE", - "original": "In AngularJS, the `ng-class` directive includes/excludes CSS classes\n based on an expression. That expression is often a key-value control object with each\n key of the object defined as a CSS class name, and each value defined as a template expression\n that evaluates to a Boolean value.", - "translation": "在 AngularJS 中,`ng-class` 指令会基于一个表达式来包含/排除某些 CSS 类。该表达式通常是一个“键-值”型的控制对象,\n 对象中的每一个键代表一个 CSS 类名,每一个值定义为一个返回布尔值的模板表达式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHEFIRSTEXAMPLETHEACTIVECLASSISAPPLIEDTOTHEELEMENTIFISACTIVEISTRUE", - "original": "In the first example, the `active` class is applied to the element if `isActive` is true.", - "translation": "在第一个例子中,如果 `isActive` 为真,则 `active` 类被应用到那个元素上。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "YOUCANSPECIFYMULTIPLECLASSESASSHOWNINTHESECONDEXAMPLE", - "original": "You can specify multiple classes, as shown in the second example.", - "translation": "就像第二个例子中所展示的那样,可以同时指定多个类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARTHENGCLASSDIRECTIVEWORKSSIMILARLYITINCLUDESEXCLUDESCSSCLASSESBASEDONANEXPRESSION", - "original": "In Angular, the `ngClass` directive works similarly.\n It includes/excludes CSS classes based on an expression.", - "translation": "在 Angular 中,`ngClass` 指令用类似的方式工作。\n 它根据一个表达式包含/排除某些 CSS 类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHEFIRSTEXAMPLETHEACTIVECLASSISAPPLIEDTOTHEELEMENTIFISACTIVEISTRUE", - "original": "In the first example, the `active` class is applied to the element if `isActive` is true.", - "translation": "在第一个例子中,如果 `isActive` 为真,则 `active` 类被应用到那个元素上。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "YOUCANSPECIFYMULTIPLECLASSESASSHOWNINTHESECONDEXAMPLE", - "original": "You can specify multiple classes, as shown in the second example.", - "translation": "就像第二个例子中所展示的那样,可以同时指定多个类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARALSOHASCLASSBINDINGWHICHISAGOODWAYTOADDORREMOVEASINGLECLASSASSHOWNINTHETHIRDEXAMPLE", - "original": "Angular also has **class binding**, which is a good way to add or remove a single class,\n as shown in the third example.", - "translation": "Angular 还有**类绑定**,它是单独添加或移除一个类的好办法 —— 就像第三个例子中展示的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEETHEATTRIBUTECLASSANDSTYLEBINDINGSGUIDETEMPLATESYNTAX#OTHERBINDINGSSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information see the [Attribute, class, and style bindings](guide/template-syntax#other-bindings)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解更多信息,参见[模板语法](guide/template-syntax)中的[属性、CSS 类和样式绑定](guide/template-syntax#other-bindings)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGCLICKDIRECTIVEALLOWSYOUTOSPECIFYCUSTOMBEHAVIORWHENANELEMENTISCLICKED", - "original": "In AngularJS, the `ng-click` directive allows you to specify custom behavior when an element is clicked.", - "translation": "在 AngularJS 中,`ng-click` 指令指定当元素被点击时的自定义行为。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHEFIRSTEXAMPLEWHENTHEUSERCLICKSTHEBUTTONTHETOGGLEIMAGEMETHODINTHECONTROLLERREFERENCEDBYTHEVMCONTROLLERASALIASISEXECUTED", - "original": "In the first example, when the user clicks the button, the `toggleImage()` method in the controller referenced by the `vm` `controller as` alias is executed.", - "translation": "在第一个例子中,如果用户点击了这个按钮,那么控制器的 `toggleImage()` 方法就会被执行,这个控制器是被 `controller as` 中指定的 `vm` 别名所引用的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THESECONDEXAMPLEDEMONSTRATESPASSINGINTHEEVENTOBJECTWHICHPROVIDESDETAILSABOUTTHEEVENTTOTHECONTROLLER", - "original": "The second example demonstrates passing in the `$event` object, which provides details about the event\n to the controller.", - "translation": "第二个例子演示了传入 `$event` 对象,它提供了事件的详情,并被传到控制器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###BINDTOTHECLICKEVENT", - "original": "### Bind to the `click` event", - "translation": "### 绑定到 `click` 事件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARJSEVENTBASEDDIRECTIVESDONOTEXISTINANGULARRATHERDEFINEONEWAYBINDINGFROMTHETEMPLATEVIEWTOTHECOMPONENTUSINGEVENTBINDING", - "original": "AngularJS event-based directives do not exist in Angular.\n Rather, define one-way binding from the template view to the component using **event binding**.", - "translation": "AngularJS 基于事件的指令在 Angular 中已经不存在了。\n 不过,可以使用**事件绑定**来定义从模板视图到组件的单向数据绑定。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FOREVENTBINDINGDEFINETHENAMEOFTHETARGETEVENTWITHINPARENTHESISANDSPECIFYATEMPLATESTATEMENTINQUOTESTOTHERIGHTOFTHEEQUALSANGULARTHENSETSUPANEVENTHANDLERFORTHETARGETEVENTWHENTHEEVENTISRAISEDTHEHANDLEREXECUTESTHETEMPLATESTATEMENT", - "original": "For event binding, define the name of the target event within parenthesis and\n specify a template statement, in quotes, to the right of the equals. Angular then\n sets up an event handler for the target event. When the event is raised, the handler\n executes the template statement.", - "translation": "要使用事件绑定,把目标事件的名字放在圆括号中,并且使用等号右侧引号中的模板语句对它赋值。\n 然后 Angular 为这个目标时间设置事件处理器。当事件被触发时,这个处理器就会执行模板语句。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHEFIRSTEXAMPLEWHENAUSERCLICKSTHEBUTTONTHETOGGLEIMAGEMETHODINTHEASSOCIATEDCOMPONENTISEXECUTED", - "original": "In the first example, when a user clicks the button, the `toggleImage()` method in the associated component is executed.", - "translation": "在第一个例子中,当用户点击此按钮时,相关组件中的 `toggleImage()` 方法就被执行了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THESECONDEXAMPLEDEMONSTRATESPASSINGINTHEEVENTOBJECTWHICHPROVIDESDETAILSABOUTTHEEVENTTOTHECOMPONENT", - "original": "The second example demonstrates passing in the `$event` object, which provides details about the event\n to the component.", - "translation": "第二个例子演示了如何传入 `$event` 对象,它为组件提供了此事件的详情。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORALISTOFDOMEVENTSSEE:HTTPS:DEVELOPERMOZILLAORGENUSDOCSWEBEVENTS", - "original": "For a list of DOM events, see: https://developer.mozilla.org/en-US/docs/Web/Events.", - "translation": "要查看 DOM 事件的列表,请参见[网络事件](https://developer.mozilla.org/en-US/docs/Web/Events)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEETHEEVENTBINDINGGUIDETEMPLATESYNTAX#EVENTBINDINGSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information, see the [Event binding](guide/template-syntax#event-binding)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解更多,请参见[模板语法](guide/template-syntax)中的[事件绑定](guide/template-syntax#event-binding)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGCONTROLLERDIRECTIVEATTACHESACONTROLLERTOTHEVIEWUSINGTHENGCONTROLLERORDEFININGTHECONTROLLERASPARTOFTHEROUTINGTIESTHEVIEWTOTHECONTROLLERCODEASSOCIATEDWITHTHATVIEW", - "original": "In AngularJS, the `ng-controller` directive attaches a controller to the view.\n Using the `ng-controller` (or defining the controller as part of the routing) ties the\n view to the controller code associated with that view.", - "translation": "在 AngularJS 中,`ng-controller` 指令把控制器附加到视图上。\n 使用 `ng-controller`(或把控制器定义为路由的一部分)把视图及其控制器的代码联系在一起。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###COMPONENTDECORATOR", - "original": "### Component decorator", - "translation": "### 组件装饰器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARTHETEMPLATENOLONGERSPECIFIESITSASSOCIATEDCONTROLLERRATHERTHECOMPONENTSPECIFIESITSASSOCIATEDTEMPLATEASPARTOFTHECOMPONENTCLASSDECORATOR", - "original": "In Angular, the template no longer specifies its associated controller.\n Rather, the component specifies its associated template as part of the component class decorator.", - "translation": "在 Angular 中,模板不用再指定它相关的控制器。\n 反过来,组件会在组件类的装饰器中指定与它相关的模板。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEEARCHITECTUREOVERVIEWGUIDEARCHITECTURE#COMPONENTS", - "original": "For more information, see [Architecture Overview](guide/architecture#components).", - "translation": "要了解更多,请参见[架构概览](guide/architecture#components)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGHIDEDIRECTIVESHOWSORHIDESTHEASSOCIATEDHTMLELEMENTBASEDONANEXPRESSIONFORMOREINFORMATIONSEENGSHOWGUIDEAJSQUICKREFERENCE#NGSHOW", - "original": "In AngularJS, the `ng-hide` directive shows or hides the associated HTML element based on\n an expression. For more information, see [ng-show](guide/ajs-quick-reference#ng-show).", - "translation": "在 AngularJS 中,`ng-hide` 指令会基于一个表达式显示或隐藏相关的 HTML 元素。\n 参见[ng-show](guide/ajs-quick-reference#ng-show)了解更多。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###BINDTOTHEHIDDENPROPERTY", - "original": "### Bind to the `hidden` property", - "translation": "### 绑定到 `hidden` 属性", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARYOUUSEPROPERTYBINDINGTHEREISNOBUILTINHIDEDIRECTIVEFORMOREINFORMATIONSEENGSHOWGUIDEAJSQUICKREFERENCE#NGSHOW", - "original": "In Angular, you use property binding; there is no built-in *hide* directive.\n For more information, see [ng-show](guide/ajs-quick-reference#ng-show).", - "translation": "在 Angular 中,并没有一个内置的 *hide* 指令,可以改用属性绑定。\n 参见[ng-show](guide/ajs-quick-reference#ng-show)了解更多。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THENGHREFDIRECTIVEALLOWSANGULARJSTOPREPROCESSTHEHREFPROPERTYSOTHATITCANREPLACETHEBINDINGEXPRESSIONWITHTHEAPPROPRIATEURLBEFORETHEBROWSERFETCHESFROMTHATURL", - "original": "The `ng-href` directive allows AngularJS to preprocess the `href` property so that it\n can replace the binding expression with the appropriate URL before the browser\n fetches from that URL.", - "translation": "`ng-href` 指令允许 AngularJS 对 `href` 属性进行预处理,以便它能在浏览器获取那个 URL 之前,使用一个返回适当 URL 的绑定表达式替换它。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGHREFISOFTENUSEDTOACTIVATEAROUTEASPARTOFNAVIGATION", - "original": "In AngularJS, the `ng-href` is often used to activate a route as part of navigation.", - "translation": "在 AngularJS 中,`ng-href` 通常用来作为导航的一部分,激活一个路由。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ROUTINGISHANDLEDDIFFERENTLYINANGULAR", - "original": "Routing is handled differently in Angular.", - "translation": "路由在 Angular 中的处理方式不同。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###BINDTOTHEHREFPROPERTY", - "original": "### Bind to the `href` property", - "translation": "### 绑定到 `href` 属性", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARUSESPROPERTYBINDINGTHEREISNOBUILTINHREFDIRECTIVEPLACETHEELEMENTSHREFPROPERTYINSQUAREBRACKETSANDSETITTOAQUOTEDTEMPLATEEXPRESSION", - "original": "Angular uses property binding; there is no built-in *href* directive.\n Place the element's `href` property in square brackets and set it to a quoted template expression.", - "translation": "在 Angular 中,并没有内置的 *href* 指令,改用属性绑定。\n 把元素的 `href` 属性放在方括号中,并把它设成一个引号中的模板表达式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEETHEPROPERTYBINDINGGUIDETEMPLATESYNTAX#PROPERTYBINDINGSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information see the [Property binding](guide/template-syntax#property-binding)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解[属性绑定](guide/template-syntax#property-binding)的更多知识,参见[模板语法](guide/template-syntax)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARHREFISNOLONGERUSEDFORROUTINGROUTINGUSESROUTERLINKASSHOWNINTHEFOLLOWINGEXAMPLE", - "original": "In Angular, `href` is no longer used for routing. Routing uses `routerLink`, as shown in the following example.", - "translation": "在 Angular 中,`href` 不再用作路由,而是改用第三个例子中所展示的 `routerLink` 指令。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONONROUTINGSEETHEROUTERLINKBINDINGGUIDEROUTER#ROUTERLINKSECTIONOFTHEROUTINGNAVIGATIONGUIDEROUTERPAGE", - "original": "For more information on routing, see the [RouterLink binding](guide/router#router-link)\n section of the [Routing & Navigation](guide/router) page.", - "translation": "要了解关于路由的更多信息,请参见[路由与导航](guide/router)的[RouterLink 绑定](guide/router#router-link)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGIFDIRECTIVEREMOVESORRECREATESAPORTIONOFTHEDOMBASEDONANEXPRESSIONIFTHEEXPRESSIONISFALSETHEELEMENTISREMOVEDFROMTHEDOM", - "original": "In AngularJS, the `ng-if` directive removes or recreates a portion of the DOM,\n based on an expression. If the expression is false, the element is removed from the DOM.", - "translation": "在 AngularJS 中,`ng-if` 指令会根据一个表达式来移除或重建 DOM 中的一部分。如果表达式为假,元素就会被从 DOM 中移除。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHISEXAMPLETHETABLEELEMENTISREMOVEDFROMTHEDOMUNLESSTHEMOVIESARRAYHASALENGTHGREATERTHANZERO", - "original": "In this example, the `` element is removed from the DOM unless the `movies` array has a length greater than zero.", - "translation": "在这个例子中,除非 `movies` 数组的长度大于 0,否则 `
` 元素就会被从 DOM 中移除。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THENGIFDIRECTIVEINANGULARWORKSTHESAMEASTHENGIFDIRECTIVEINANGULARJSITREMOVESORRECREATESAPORTIONOFTHEDOMBASEDONANEXPRESSION", - "original": "The `*ngIf` directive in Angular works the same as the `ng-if` directive in AngularJS. It removes\n or recreates a portion of the DOM based on an expression.", - "translation": "Angular 中的 `*ngIf` 指令与 AngularJS 中的 `ng-if` 指令一样,\n 它根据表达式的值移除或重建 DOM 中的一部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHISEXAMPLETHETABLEELEMENTISREMOVEDFROMTHEDOMUNLESSTHEMOVIESARRAYHASALENGTH", - "original": "In this example, the `
` element is removed from the DOM unless the `movies` array has a length.", - "translation": "在这个例子中,除非 `movies` 数组的长度大于 0,否则 `
` 元素就会被从 DOM 中移除。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THEBEFORENGIFISREQUIREDINTHISEXAMPLEFORMOREINFORMATIONSEESTRUCTURALDIRECTIVESGUIDESTRUCTURALDIRECTIVES", - "original": "The (*) before `ngIf` is required in this example.\n For more information, see [Structural Directives](guide/structural-directives).", - "translation": "在这个例子中 `ngIf` 前的星号(*)是必须的。\n 要了解更多信息,参见[结构型指令](guide/structural-directives)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGMODELDIRECTIVEBINDSAFORMCONTROLTOAPROPERTYINTHECONTROLLERASSOCIATEDWITHTHETEMPLATETHISPROVIDESTWOWAYBINDINGWHEREBYANYCHANGEMADETOTHEVALUEINTHEVIEWISSYNCHRONIZEDWITHTHEMODELANDANYCHANGETOTHEMODELISSYNCHRONIZEDWITHTHEVALUEINTHEVIEW", - "original": "In AngularJS, the `ng-model` directive binds a form control to a property in the controller associated with the template.\n This provides **two-way binding**, whereby any change made to the value in the view is synchronized with the model, and any change to the model is synchronized with the value in the view.", - "translation": "在 Angular1 中,`ng-model` 指令把一个表单控件绑定到了模板相关控制器的一个属性上。\n 这提供了**双向绑定**功能,因此,任何对视图中值的改动,都会同步到模型中,对模型的改动,也会同步到视图中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARTWOWAYBINDINGISDENOTEDBYDESCRIPTIVELYREFERREDTOASABANANAINABOXTHISSYNTAXISASHORTCUTFORDEFININGBOTHPROPERTYBINDINGFROMTHECOMPONENTTOTHEVIEWANDEVENTBINDINGFROMTHEVIEWTOTHECOMPONENTTHEREBYPROVIDINGTWOWAYBINDING", - "original": "In Angular, **two-way binding** is denoted by `[()]`, descriptively referred to as a \"banana in a box\". This syntax is a shortcut for defining both property binding (from the component to the view)\n and event binding (from the view to the component), thereby providing two-way binding.", - "translation": "在 Angular 中,**双向绑定**使用[()]标记出来,它被形象的比作“盒子中的香蕉”。\n 这种语法是一个简写形式,用来同时定义一个属性绑定(从组件到视图)和一个事件绑定(从视图到组件),就成了双向绑定。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONONTWOWAYBINDINGWITHNGMODELSEETHENGMODELMDASHTWOWAYBINDINGTOFORMELEMENTSWITHNGMODELGUIDETEMPLATESYNTAXHTML#NGMODELSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information on two-way binding with `ngModel`, see the [NgModel—Two-way binding to\n form elements with `[(ngModel)]`](../guide/template-syntax.html#ngModel)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解使用 ngModel 进行双向绑定的更多知识,参见[模板语法](guide/template-syntax)中的[NgModel—使用 `[(ngModel)]` 进行双向绑定](../guide/template-syntax.html#ngModel)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGREPEATDIRECTIVEREPEATSTHEASSOCIATEDDOMELEMENTFOREACHITEMINTHESPECIFIEDCOLLECTION", - "original": "In AngularJS, the `ng-repeat` directive repeats the associated DOM element\n for each item in the specified collection.", - "translation": "在 Angular1 中,`ng-repeat` 指令会为指定集合中的每一个条目重复渲染相关的 DOM 元素。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHISEXAMPLETHETABLEROWTRELEMENTREPEATSFOREACHMOVIEOBJECTINTHECOLLECTIONOFMOVIES", - "original": "In this example, the table row (``) element repeats for each movie object in the collection of movies.", - "translation": "在这个例子中,对 `movies` 集合中的每一个 `movie` 对象重复渲染了这个表格行元素(``)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THENGFORDIRECTIVEINANGULARISSIMILARTOTHENGREPEATDIRECTIVEINANGULARJSITREPEATSTHEASSOCIATEDDOMELEMENTFOREACHITEMINTHESPECIFIEDCOLLECTIONMOREACCURATELYITTURNSTHEDEFINEDELEMENTTRINTHISEXAMPLEANDITSCONTENTSINTOATEMPLATEANDUSESTHATTEMPLATETOINSTANTIATEAVIEWFOREACHITEMINTHELIST", - "original": "The `*ngFor` directive in Angular is similar to the `ng-repeat` directive in AngularJS. It repeats\n the associated DOM element for each item in the specified collection.\n More accurately, it turns the defined element (`` in this example) and its contents into a template and\n uses that template to instantiate a view for each item in the list.", - "translation": "Angular 中的 `*ngFor` 指令类似于 AngularJS 中的 `ng-repeat` 指令。\n 它为指定集合中的每一个条目重复渲染了相关的 DOM 元素。\n 更准确的说,它把被界定出来的元素(这个例子中是 ``)及其内容转成了一个模板,并使用那个模板来为列表中的每一个条目实例化一个视图。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "NOTICETHEOTHERSYNTAXDIFFERENCES:THEBEFORENGFORISREQUIREDTHELETKEYWORDIDENTIFIESMOVIEASANINPUTVARIABLETHELISTPREPOSITIONISOFNOTIN", - "original": "Notice the other syntax differences:\n The (*) before `ngFor` is required;\n the `let` keyword identifies `movie` as an input variable;\n the list preposition is `of`, not `in`.", - "translation": "请注意其它语法上的差异:\n 在 `ngFor` 前面的星号(*)是必须的;`let` 关键字把 `movie` 标记成一个输入变量;列表中使用的介词是 `of`,而不再是 `in`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEESTRUCTURALDIRECTIVESGUIDESTRUCTURALDIRECTIVES", - "original": "For more information, see [Structural Directives](guide/structural-directives).", - "translation": "要了解更多信息,参见[结构性指令](guide/structural-directives)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGSHOWDIRECTIVESHOWSORHIDESTHEASSOCIATEDDOMELEMENTBASEDONANEXPRESSION", - "original": "In AngularJS, the `ng-show` directive shows or hides the associated DOM element, based on\n an expression.", - "translation": "在 AngularJS 中,`ng-show` 指令根据一个表达式来显示或隐藏相关的 DOM 元素。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHISEXAMPLETHEDIVELEMENTISSHOWNIFTHEFAVORITEHEROVARIABLEISTRUTHY", - "original": "In this example, the `
` element is shown if the `favoriteHero` variable is truthy.", - "translation": "在这个例子中,如果 `favoriteHero` 变量为真,`
` 元素就会显示出来。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###BINDTOTHEHIDDENPROPERTY", - "original": "### Bind to the `hidden` property", - "translation": "### 绑定到 `hidden` 属性", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARUSESPROPERTYBINDINGTHEREISNOBUILTINSHOWDIRECTIVEFORHIDINGANDSHOWINGELEMENTSBINDTOTHEHTMLHIDDENPROPERTY", - "original": "Angular uses property binding; there is no built-in *show* directive.\n For hiding and showing elements, bind to the HTML `hidden` property.", - "translation": "在 Angular 中,并没有内置的 *show* 指令,可以改用属性绑定。\n 要隐藏或显示一个元素,绑定到它的 `hidden` 属性就可以了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "TOCONDITIONALLYDISPLAYANELEMENTPLACETHEELEMENTSHIDDENPROPERTYINSQUAREBRACKETSANDSETITTOAQUOTEDTEMPLATEEXPRESSIONTHATEVALUATESTOTHEOPPOSITEOFSHOW", - "original": "To conditionally display an element, place the element's `hidden` property in square brackets and\n set it to a quoted template expression that evaluates to the *opposite* of *show*.", - "translation": "要想有条件的显示一个元素,就把该元素的 `hidden` 属性放到一个方括号里,并且把它设置为引号中的模板表达式,它的结果应该是与*显示*时*相反*的值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHISEXAMPLETHEDIVELEMENTISHIDDENIFTHEFAVORITEHEROVARIABLEISNOTTRUTHY", - "original": "In this example, the `
` element is hidden if the `favoriteHero` variable is not truthy.", - "translation": "在这个例子中,如果 `favoriteHero` 变量不是真值,`
` 元素就会被隐藏。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONONPROPERTYBINDINGSEETHEPROPERTYBINDINGGUIDETEMPLATESYNTAX#PROPERTYBINDINGSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information on property binding, see the [Property binding](guide/template-syntax#property-binding)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解属性绑定的更多知识,参见[模板语法](guide/template-syntax)中的[属性绑定](guide/template-syntax#property-binding)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THENGSRCDIRECTIVEALLOWSANGULARJSTOPREPROCESSTHESRCPROPERTYSOTHATITCANREPLACETHEBINDINGEXPRESSIONWITHTHEAPPROPRIATEURLBEFORETHEBROWSERFETCHESFROMTHATURL", - "original": "The `ng-src` directive allows AngularJS to preprocess the `src` property so that it\n can replace the binding expression with the appropriate URL before the browser\n fetches from that URL.", - "translation": "`ng-src` 指令允许 AngularJS 对 `src` 属性进行预处理,以便它能够在浏览器获取此 URL 之前,用一个返回适当 URL 的绑定表达式替换它。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###BINDTOTHESRCPROPERTY", - "original": "### Bind to the `src` property", - "translation": "### 绑定到 `src` 属性", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARUSESPROPERTYBINDINGTHEREISNOBUILTINSRCDIRECTIVEPLACETHESRCPROPERTYINSQUAREBRACKETSANDSETITTOAQUOTEDTEMPLATEEXPRESSION", - "original": "Angular uses property binding; there is no built-in *src* directive.\n Place the `src` property in square brackets and set it to a quoted template expression.", - "translation": "在 Angular 中,并没有一个内置的 *src* 指令,可以使用属性绑定。\n 把 `src` 属性放到方括号中,并且把它设为一个引号中的绑定表达式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONONPROPERTYBINDINGSEETHEPROPERTYBINDINGGUIDETEMPLATESYNTAX#PROPERTYBINDINGSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information on property binding, see the [Property binding](guide/template-syntax#property-binding)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解属性绑定的更多知识,参见[模板语法](guide/template-syntax)中的[属性绑定](guide/template-syntax#property-binding)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGSTYLEDIRECTIVESETSACSSSTYLEONANHTMLELEMENTBASEDONANEXPRESSIONTHATEXPRESSIONISOFTENAKEYVALUECONTROLOBJECTWITHEACHKEYOFTHEOBJECTDEFINEDASACSSPROPERTYANDEACHVALUEDEFINEDASANEXPRESSIONTHATEVALUATESTOAVALUEAPPROPRIATEFORTHESTYLE", - "original": "In AngularJS, the `ng-style` directive sets a CSS style on an HTML element\n based on an expression. That expression is often a key-value control object with each\n key of the object defined as a CSS property, and each value defined as an expression\n that evaluates to a value appropriate for the style.", - "translation": "在 AngularJS 中,`ng-style` 指令根据一个绑定表达式设置一个 HTML 元素的 CSS 样式。\n 该表达式通常是一个“键-值”形式的控制对象,对象的每个键都是一个 CSS 属性,每个值都是一个能计算为此样式的合适值的表达式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHEEXAMPLETHECOLORSTYLEISSETTOTHECURRENTVALUEOFTHECOLORPREFERENCEVARIABLE", - "original": "In the example, the `color` style is set to the current value of the `colorPreference` variable.", - "translation": "在这个例子中,`color` 样式被设置为 `colorPreference` 变量的当前值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARTHENGSTYLEDIRECTIVEWORKSSIMILARLYITSETSACSSSTYLEONANHTMLELEMENTBASEDONANEXPRESSION", - "original": "In Angular, the `ngStyle` directive works similarly. It sets a CSS style on an HTML element based on an expression.", - "translation": "在 Angular 中,`ngStyle` 指令的工作方式与此类似。它根据一个表达式设置 HTML 元素上的 CSS 样式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHEFIRSTEXAMPLETHECOLORSTYLEISSETTOTHECURRENTVALUEOFTHECOLORPREFERENCEVARIABLE", - "original": "In the first example, the `color` style is set to the current value of the `colorPreference` variable.", - "translation": "在第一个例子中,`color` 样式被设置成了 `colorPreference` 变量的当前值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARALSOHASSTYLEBINDINGWHICHISGOODWAYTOSETASINGLESTYLETHISISSHOWNINTHESECONDEXAMPLE", - "original": "Angular also has **style binding**, which is good way to set a single style. This is shown in the second example.", - "translation": "Angular 还有**样式绑定**语法,它是单独设置一个样式的好方法。它展示在第二个例子中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONONSTYLEBINDINGSEETHESTYLEBINDINGGUIDETEMPLATESYNTAX#STYLEBINDINGSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information on style binding, see the [Style binding](guide/template-syntax#style-binding) section of the\n [Template Syntax](guide/template-syntax) page.", - "translation": "要了解样式绑定的更多知识,参见[模板语法](guide/template-syntax)中的[样式绑定](guide/template-syntax#style-binding)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONONTHENGSTYLEDIRECTIVESEENGSTYLEGUIDETEMPLATESYNTAX#NGSTYLESECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information on the `ngStyle` directive, see [NgStyle](guide/template-syntax#ngStyle)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解关于 `ngStyle` 指令的更多知识,参见[模板语法](guide/template-syntax)中的[NgStyle](guide/template-syntax#ngStyle)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSTHENGSWITCHDIRECTIVESWAPSTHECONTENTSOFANELEMENTBYSELECTINGONEOFTHETEMPLATESBASEDONTHECURRENTVALUEOFANEXPRESSION", - "original": "In AngularJS, the `ng-switch` directive swaps the contents of\n an element by selecting one of the templates based on the current value of an expression.", - "translation": "在 Angular1 中,`ng-switch` 指令根据一个表达式的当前值把元素的内容替换成几个模板之一。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHISEXAMPLEIFFAVORITEHEROISNOTSETTHETEMPLATEDISPLAYSPLEASEENTERIFFAVORITEHEROISSETITCHECKSTHEMOVIEHEROBYCALLINGACONTROLLERMETHODIFTHATMETHODRETURNSTRUETHETEMPLATEDISPLAYSEXCELLENTCHOICEIFTHATMETHODSRETURNSFALSETHETEMPLATEDISPLAYSNOMOVIESORRY", - "original": "In this example, if `favoriteHero` is not set, the template displays \"Please enter ...\".\n If `favoriteHero` is set, it checks the movie hero by calling a controller method.\n If that method returns `true`, the template displays \"Excellent choice!\".\n If that methods returns `false`, the template displays \"No movie, sorry!\".", - "translation": "在这个例子中,如果 `favoriteHero` 没有设置,则模板显示“Please enter ...”。\n 如果 `favoriteHero` 设置过,它就会通过调用一个控制其方法来检查它是否电影里的英雄。\n 如果该方法返回 `true`,模板就会显示“Excellent choice!”。\n 如果该方法返回 `false`,该模板就会显示“No movie, sorry!”。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARTHENGSWITCHDIRECTIVEWORKSSIMILARLYITDISPLAYSANELEMENTWHOSENGSWITCHCASEMATCHESTHECURRENTNGSWITCHEXPRESSIONVALUE", - "original": "In Angular, the `ngSwitch` directive works similarly.\n It displays an element whose `*ngSwitchCase` matches the current `ngSwitch` expression value.", - "translation": "在 Angular 中,`ngSwitch` 指令的工作方式与此类似。\n 它会显示那个与 `ngSwitch` 表达式的当前值匹配的那个 `*ngSwitchCase` 所在的元素。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INTHISEXAMPLEIFFAVORITEHEROISNOTSETTHENGSWITCHVALUEISNULLANDNGSWITCHDEFAULTDISPLAYSPLEASEENTERIFFAVORITEHEROISSETTHEAPPCHECKSTHEMOVIEHEROBYCALLINGACOMPONENTMETHODIFTHATMETHODRETURNSTRUETHEAPPSELECTSNGSWITCHCASETRUEANDDISPLAYS:EXCELLENTCHOICEIFTHATMETHODSRETURNSFALSETHEAPPSELECTSNGSWITCHCASEFALSEANDDISPLAYS:NOMOVIESORRY", - "original": "In this example, if `favoriteHero` is not set, the `ngSwitch` value is `null`\n and `*ngSwitchDefault` displays, \"Please enter ...\".\n If `favoriteHero` is set, the app checks the movie hero by calling a component method.\n If that method returns `true`, the app selects `*ngSwitchCase=\"true\"` and displays: \"Excellent choice!\"\n If that methods returns `false`, the app selects `*ngSwitchCase=\"false\"` and displays: \"No movie, sorry!\"", - "translation": "在这个例子中,如果 `favoriteHero` 没有设置,则 `ngSwitch` 的值是 `null`,\n `*ngSwitchDefault` 中会显示 “Please enter ...”。\n 如果设置了 `favoriteHero`,应用就会通过调用一个组件方法来检查电影英雄。\n 如果该方法返回 `true`,就会显示 “Excellent choice!”。\n 如果该方法返回 `false`,就会显示 “No movie, sorry!”。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THEBEFORENGSWITCHCASEANDNGSWITCHDEFAULTISREQUIREDINTHISEXAMPLE", - "original": "The (*) before `ngSwitchCase` and `ngSwitchDefault` is required in this example.", - "translation": "在这个例子中,`ngSwitchCase` 和 `ngSwitchDefault` 前面的星号(*)是必须的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEETHENGSWITCHDIRECTIVESGUIDETEMPLATESYNTAX#NGSWITCHSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "original": "For more information, see [The NgSwitch directives](guide/template-syntax#ngSwitch)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解更多信息,参见[模板语法](guide/template-syntax)中的[NgSwitch 指令](guide/template-syntax#ngSwitch)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "##FILTERSPIPES", - "original": "## Filters/pipes", - "translation": "## 过滤器/管道", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARPIPESPROVIDEFORMATTINGANDTRANSFORMATIONFORDATAINTHETEMPLATESIMILARTOANGULARJSFILTERSMANYOFTHEBUILTINFILTERSINANGULARJSHAVECORRESPONDINGPIPESINANGULARFORMOREINFORMATIONONPIPESSEEPIPESGUIDEPIPES", - "original": "Angular **pipes** provide formatting and transformation for data in the template, similar to AngularJS **filters**.\nMany of the built-in filters in AngularJS have corresponding pipes in Angular.\nFor more information on pipes, see [Pipes](guide/pipes).", - "translation": "Angular 中的**管道**为模板提供了格式化和数据转换功能,类似于 AngularJS 中的**过滤器**。\nAngularJS 中的很多内置过滤器在 Angular 中都有对应的管道。\n要了解管道的更多信息,参见[Pipes](guide/pipes)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMATSANUMBERASCURRENCY", - "original": "Formats a number as currency.", - "translation": "把一个数字格式化成货币。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THEANGULARCURRENCYPIPEISSIMILARALTHOUGHSOMEOFTHEPARAMETERSHAVECHANGED", - "original": "The Angular `currency` pipe is similar although some of the parameters have changed.", - "translation": "Angular 的 `currency` 管道和 1 中很相似,只是有些参数变化了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMATSADATETOASTRINGBASEDONTHEREQUESTEDFORMAT", - "original": "Formats a date to a string based on the requested format.", - "translation": "基于要求的格式把日期格式化成字符串。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THEANGULARDATEPIPEISSIMILAR", - "original": "The Angular `date` pipe is similar.", - "translation": "Angular 的 `date` 管道和它很相似。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "SELECTSASUBSETOFITEMSFROMTHEDEFINEDCOLLECTIONBASEDONTHEFILTERCRITERIA", - "original": "Selects a subset of items from the defined collection, based on the filter criteria.", - "translation": "基于过滤条件从指定的集合中选取出一个子集。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###NONE", - "original": "### none", - "translation": "### 没了", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORPERFORMANCEREASONSNOCOMPARABLEPIPEEXISTSINANGULARDOALLYOURFILTERINGINTHECOMPONENTIFYOUNEEDTHESAMEFILTERINGCODEINSEVERALTEMPLATESCONSIDERBUILDINGACUSTOMPIPE", - "original": "For performance reasons, no comparable pipe exists in Angular. Do all your filtering in the component. If you need the same filtering code in several templates, consider building a custom pipe.", - "translation": "在 Angular 中,出于性能的考虑,并没有一个类似的管道。\n 过滤逻辑应该在组件中用代码实现。\n 如果它将被复用在几个模板中,可以考虑构建一个自定义管道。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "CONVERTSAJAVASCRIPTOBJECTINTOAJSONSTRINGTHISISUSEFULFORDEBUGGING", - "original": "Converts a JavaScript object into a JSON string. This is useful for debugging.", - "translation": "把一个 JavaScript 对象转换成一个 JSON 字符串。这对调试很有用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THEANGULARJSONPIPEDOESTHESAMETHING", - "original": "The Angular `json` pipe does the same thing.", - "translation": "Angular 的 `json` 管道做完全相同的事。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "SELECTSUPTOTHEFIRSTPARAMETER2NUMBEROFITEMSFROMTHECOLLECTIONSTARTINGOPTIONALLYATTHEBEGINNINGINDEX0", - "original": "Selects up to the first parameter (2) number of items from the collection\n starting (optionally) at the beginning index (0).", - "translation": "从集合中选择从(第二参数指定的)起始索引号(0)开始的最多(第一参数指定的)条目数(2)个条目。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THESLICEPIPEDOESTHESAMETHINGBUTTHEORDEROFTHEPARAMETERSISREVERSEDINKEEPINGWITHTHEJAVASCRIPTSLICEMETHODTHEFIRSTPARAMETERISTHESTARTINGINDEXTHESECONDISTHELIMITASINANGULARJSCODINGTHISOPERATIONWITHINTHECOMPONENTINSTEADCOULDIMPROVEPERFORMANCE", - "original": "The `SlicePipe` does the same thing but the *order of the parameters is reversed*, in keeping\n with the JavaScript `Slice` method.\n The first parameter is the starting index; the second is the limit.\n As in AngularJS, coding this operation within the component instead could improve performance.", - "translation": "`SlicePipe` 做同样的事,但是*两个参数的顺序是相反的*,以便于 JavaScript 中的 `slice` 方法保持一致。\n 第一个参数是起始索引号,第二个参数是限制的数量。\n 和 AngularJS 中一样,如果们改用组件中的代码实现此操作,性能将会提升。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "CONVERTSTHESTRINGTOLOWERCASE", - "original": "Converts the string to lowercase.", - "translation": "把该字符串转成小写形式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THEANGULARLOWERCASEPIPEDOESTHESAMETHING", - "original": "The Angular `lowercase` pipe does the same thing.", - "translation": "Angular 的 `lowercase` 管道和 1 中的功能完全相同。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMATSANUMBERASTEXT", - "original": "Formats a number as text.", - "translation": "把数字格式化为文本。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THEANGULARNUMBERPIPEISSIMILARITPROVIDESMOREFUNCTIONALITYWHENDEFININGTHEDECIMALPLACESASSHOWNINTHESECONDEXAMPLEABOVE", - "original": "The Angular `number` pipe is similar.\n It provides more functionality when defining\n the decimal places, as shown in the second example above.", - "translation": "Angular 的 `number` 管道很相似。\n 但在指定小数点位置时,它提供了更多的功能,如第二个范例所示。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARALSOHASAPERCENTPIPEWHICHFORMATSANUMBERASALOCALPERCENTAGEASSHOWNINTHETHIRDEXAMPLE", - "original": "Angular also has a `percent` pipe, which formats a number as a local percentage\n as shown in the third example.", - "translation": "Angular 还有一个 `percent` 管道,它把一个数组格式化为本地化的(local)百分比格式,如第三个范例所示。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "DISPLAYSTHECOLLECTIONINTHEORDERSPECIFIEDBYTHEEXPRESSIONINTHISEXAMPLETHEMOVIETITLEORDERSTHEMOVIELIST", - "original": "Displays the collection in the order specified by the expression.\n In this example, the movie title orders the `movieList`.", - "translation": "使用表达式中所指定的方式对集合进行排序。\n 在这个例子中,`movieList` 被根据 movie 的 title 排序了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###NONE", - "original": "### none", - "translation": "### 没了", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORPERFORMANCEREASONSNOCOMPARABLEPIPEEXISTSINANGULARINSTEADUSECOMPONENTCODETOORDERORSORTRESULTSIFYOUNEEDTHESAMEORDERINGORSORTINGCODEINSEVERALTEMPLATESCONSIDERBUILDINGACUSTOMPIPE", - "original": "For performance reasons, no comparable pipe exists in Angular.\n Instead, use component code to order or sort results. If you need the same ordering or sorting code in several templates, consider building a custom pipe.", - "translation": "在 Angular 中,出于性能的考虑,并没有一个类似的管道。\n 排序逻辑应该在组件中用代码实现。\n 如果它将被复用在几个模板中,可以考虑构建一个自定义管道。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "##MODULESCONTROLLERSCOMPONENTS", - "original": "## Modules/controllers/components", - "translation": "## 模块/控制器/组件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INBOTHANGULARJSANDANGULARMODULESHELPYOUORGANIZEYOURAPPLICATIONINTOCOHESIVEBLOCKSOFFUNCTIONALITY", - "original": "In both AngularJS and Angular, modules help you organize your application into cohesive blocks of functionality.", - "translation": "无论在 AngularJS 还是 Angular 中,你都要借助“模块”来把应用拆分成一些紧密相关的功能块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSYOUWRITETHECODETHATPROVIDESTHEMODELANDTHEMETHODSFORTHEVIEWINACONTROLLERINANGULARYOUBUILDACOMPONENT", - "original": "In AngularJS, you write the code that provides the model and the methods for the view in a **controller**.\nIn Angular, you build a **component**.", - "translation": "在 AngularJS 中,你要在**控制器**中写代码,来为视图提供模型和方法。\n在 Angular 中,你要创建**组件**。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "BECAUSEMUCHANGULARJSCODEISINJAVASCRIPTJAVASCRIPTCODEISSHOWNINTHEANGULARJSCOLUMNTHEANGULARCODEISSHOWNUSINGTYPESCRIPT", - "original": "Because much AngularJS code is in JavaScript, JavaScript code is shown in the AngularJS column.\nThe Angular code is shown using TypeScript.", - "translation": "因为很多 AngularJS 的代码是用 JavaScript 写的,所以在 AngularJS 列显示的是 JavaScript 代码,而 Angular 列显示的是 TypeScript 代码。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSANIMMEDIATELYINVOKEDFUNCTIONEXPRESSIONORIIFEAROUNDCONTROLLERCODEKEEPSITOUTOFTHEGLOBALNAMESPACE", - "original": "In AngularJS, an immediately invoked function expression (or IIFE) around controller code\n keeps it out of the global namespace.", - "translation": "在 AngularJS 中,用立即调用的函数表达式(IIFE)来包裹控制器代码可以让控制器代码不会污染全局命名空间。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###NONE", - "original": "### none", - "translation": "### 没了", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THISISANONISSUEINANGULARBECAUSEES2015MODULESHANDLETHENAMESPACINGFORYOU", - "original": "This is a nonissue in Angular because ES 2015 modules\n handle the namespacing for you.", - "translation": "在 Angular 中不用担心这个问题,因为使用 ES 2015 的模块,模块会替你处理命名空间问题。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONONMODULESSEETHEMODULESGUIDEARCHITECTURE#MODULESSECTIONOFTHEARCHITECTUREOVERVIEWGUIDEARCHITECTURE", - "original": "For more information on modules, see the [Modules](guide/architecture#modules) section of the\n [Architecture Overview](guide/architecture).", - "translation": "要了解关于模块的更多信息,参见[架构概览](guide/architecture)中的[模块](guide/architecture#modules)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###ANGULARMODULES", - "original": "### Angular modules", - "translation": "### Angular 模块", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSANANGULARMODULEKEEPSTRACKOFCONTROLLERSSERVICESANDOTHERCODETHESECONDARGUMENTDEFINESTHELISTOFOTHERMODULESTHATTHISMODULEDEPENDSUPON", - "original": "In AngularJS, an Angular module keeps track of controllers, services, and other code.\n The second argument defines the list of other modules that this module depends upon.", - "translation": "在 AngularJS 中,Angular 模块用来对控制器、服务和其它代码进行跟踪。第二个参数定义该模块依赖的其它模块列表。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "NGMODULESDEFINEDWITHTHENGMODULEDECORATORSERVETHESAMEPURPOSE:", - "original": "NgModules, defined with the `NgModule` decorator, serve the same purpose:", - "translation": "Angular 的模块用 `NgModule` 装饰器进行定义,有如下用途:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "IMPORTS:SPECIFIESTHELISTOFOTHERMODULESTHATTHISMODULEDEPENDSUPON", - "original": "* `imports`: specifies the list of other modules that this module depends upon", - "translation": "`imports`: 指定当前模块依赖的其它模块列表", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "DECLARATION:KEEPSTRACKOFYOURCOMPONENTSPIPESANDDIRECTIVES", - "original": "* `declaration`: keeps track of your components, pipes, and directives.", - "translation": "`declaration`: 用于记录组件、管道和指令。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONONMODULESSEENGMODULESGUIDENGMODULES", - "original": "For more information on modules, see [NgModules](guide/ngmodules).", - "translation": "要了解关于模块的更多知识,参见[NgModules](guide/ngmodules)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###CONTROLLERREGISTRATION", - "original": "### Controller registration", - "translation": "### 控制器注册", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARJSHASCODEINEACHCONTROLLERTHATLOOKSUPANAPPROPRIATEANGULARMODULEANDREGISTERSTHECONTROLLERWITHTHATMODULE", - "original": "AngularJS has code in each controller that looks up an appropriate Angular module\n and registers the controller with that module.", - "translation": "在 AngularJS 中,在每个控制器中都有一些代码,用于找到合适的 Angular 模块并把该控制器注册进去。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THEFIRSTARGUMENTISTHECONTROLLERNAMETHESECONDARGUMENTDEFINESTHESTRINGNAMESOFALLDEPENDENCIESINJECTEDINTOTHISCONTROLLERANDAREFERENCETOTHECONTROLLERFUNCTION", - "original": "The first argument is the controller name. The second argument defines the string names of\n all dependencies injected into this controller, and a reference to the controller function.", - "translation": "第一个参数是控制器的名称,第二个参数定义了所有将注入到该控制器的依赖的字符串名称,以及一个到控制器函数的引用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###COMPONENTDECORATOR", - "original": "### Component decorator", - "translation": "### 组件装饰器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARADDSADECORATORTOTHECOMPONENTCLASSTOPROVIDEANYREQUIREDMETADATATHECOMPONENTDECORATORDECLARESTHATTHECLASSISACOMPONENTANDPROVIDESMETADATAABOUTTHATCOMPONENTSUCHASITSSELECTORORTAGANDITSTEMPLATE", - "original": "Angular adds a decorator to the component class to provide any required metadata.\n The `@Component` decorator declares that the class is a component and provides metadata about\n that component such as its selector (or tag) and its template.", - "translation": "Angular 会往组件类上添加了一个装饰器,以提供所需的任何元数据。\n `@Component` 装饰器把该类声明为组件,并提供了关于该组件的元数据,比如它的选择器(或标签)和模板。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THISISHOWYOUASSOCIATEATEMPLATEWITHLOGICWHICHISDEFINEDINTHECOMPONENTCLASS", - "original": "This is how you associate a template with logic, which is defined in the component class.", - "translation": "这就是把模板关联到代码的方式,它定义在组件类中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEETHECOMPONENTSGUIDEARCHITECTURE#COMPONENTSSECTIONOFTHEARCHITECTUREOVERVIEWGUIDEARCHITECTUREPAGE", - "original": "For more information, see the [Components](guide/architecture#components)\n section of the [Architecture Overview](guide/architecture) page.", - "translation": "要了解关于组件的更多信息,参见[架构概览](guide/architecture)中的[组件](guide/architecture#components)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###CONTROLLERFUNCTION", - "original": "### Controller function", - "translation": "### 控制器函数", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSYOUWRITETHECODEFORTHEMODELANDMETHODSINACONTROLLERFUNCTION", - "original": "In AngularJS, you write the code for the model and methods in a controller function.", - "translation": "在 Angular1 中,你在控制器函数中编写模型和方法的代码。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###COMPONENTCLASS", - "original": "### Component class", - "translation": "### 组件类", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARYOUCREATEACOMPONENTCLASS", - "original": "In Angular, you create a component class.", - "translation": "在 Angular 中,你要创建组件类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "NOTE:IFYOUAREUSINGTYPESCRIPTWITHANGULARJSYOUMUSTUSETHEEXPORTKEYWORDTOEXPORTTHECOMPONENTCLASS", - "original": "NOTE: If you are using TypeScript with AngularJS, you must use the `export` keyword to export the component class.", - "translation": "注意:如果你正在用 TypeScript 写 AngularJS,那么必须用 `export` 关键字来导出组件类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEETHECOMPONENTSGUIDEARCHITECTURE#COMPONENTSSECTIONOFTHEARCHITECTUREOVERVIEWGUIDEARCHITECTUREPAGE", - "original": "For more information, see the [Components](guide/architecture#components)\n section of the [Architecture Overview](guide/architecture) page.", - "translation": "要了解关于组件的更多信息,参见[架构概览](guide/architecture)中的[组件](guide/architecture#components)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###DEPENDENCYINJECTION", - "original": "### Dependency injection", - "translation": "### 依赖注入", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARJSYOUPASSINANYDEPENDENCIESASCONTROLLERFUNCTIONARGUMENTSTHISEXAMPLEINJECTSAMOVIESERVICE", - "original": "In AngularJS, you pass in any dependencies as controller function arguments.\n This example injects a `MovieService`.", - "translation": "在 AngularJS 中,你把所有依赖都作为控制器函数的参数。\n 这个例子注入了一个 `MovieService`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "TOGUARDAGAINSTMINIFICATIONPROBLEMSTELLANGULAREXPLICITLYTHATITSHOULDINJECTANINSTANCEOFTHEMOVIESERVICEINTHEFIRSTPARAMETER", - "original": "To guard against minification problems, tell Angular explicitly\n that it should inject an instance of the `MovieService` in the first parameter.", - "translation": "为了防止在最小化时出现问题,第一个参数明确告诉 Angular 它应该注入一个 `MovieService` 的实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###DEPENDENCYINJECTION", - "original": "### Dependency injection", - "translation": "### 依赖注入", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARYOUPASSINDEPENDENCIESASARGUMENTSTOTHECOMPONENTCLASSCONSTRUCTORTHISEXAMPLEINJECTSAMOVIESERVICETHEFIRSTPARAMETERSTYPESCRIPTTYPETELLSANGULARWHATTOINJECTEVENAFTERMINIFICATION", - "original": "In Angular, you pass in dependencies as arguments to the component class constructor.\n This example injects a `MovieService`.\n The first parameter's TypeScript type tells Angular what to inject, even after minification.", - "translation": "在 Angular 中,你要把依赖作为组件构造函数的参数传入。\n 这个例子注入了一个 `MovieService`。\n 即使在最小化之后,第一个参数的 TypeScript 类型也会告诉 Angular 它该注入什么。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "FORMOREINFORMATIONSEETHEDEPENDENCYINJECTIONGUIDEARCHITECTURE#DEPENDENCYINJECTIONSECTIONOFTHEARCHITECTUREOVERVIEWGUIDEARCHITECTURE", - "original": "For more information, see the [Dependency injection](guide/architecture#dependency-injection)\n section of the [Architecture Overview](guide/architecture).", - "translation": "要了解关于依赖注入的更多信息,参见[架构概览](guide/architecture)中的[依赖注入](guide/architecture#dependency-injection)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "##STYLESHEETS", - "original": "## Style sheets", - "translation": "## 样式表", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "STYLESHEETSGIVEYOURAPPLICATIONANICELOOKINANGULARJSYOUSPECIFYTHESTYLESHEETSFORYOURENTIREAPPLICATIONASTHEAPPLICATIONGROWSOVERTIMETHESTYLESFORTHEMANYPARTSOFTHEAPPLICATIONMERGEWHICHCANCAUSEUNEXPECTEDRESULTSINANGULARYOUCANSTILLDEFINESTYLESHEETSFORYOURENTIREAPPLICATIONBUTNOWYOUCANALSOENCAPSULATEASTYLESHEETWITHINASPECIFICCOMPONENT", - "original": "Style sheets give your application a nice look.\nIn AngularJS, you specify the style sheets for your entire application.\nAs the application grows over time, the styles for the many parts of the application\nmerge, which can cause unexpected results.\nIn Angular, you can still define style sheets for your entire application. But now you can\nalso encapsulate a style sheet within a specific component.", - "translation": "样式表让你的应用程序看起来更漂亮。\n在 AngularJS 中,你要为整个应用程序指定样式表。\n随着应用程序的不断成长,为各个部分指定的样式会被合并,导致无法预计的后果。\n在 Angular 中,你仍然要为整个应用程序定义样式,不过现在也可以把样式表封装在特定的组件中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###LINKTAG", - "original": "### Link tag", - "translation": "### Link 标签", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "ANGULARJSUSESALINKTAGINTHEHEADSECTIONOFTHEINDEXHTMLFILETODEFINETHESTYLESFORTHEAPPLICATION", - "original": "AngularJS, uses a `link` tag in the head section of the `index.html` file\n to define the styles for the application.", - "translation": "AngularJS 在 `index.html` 的 `head` 区使用 `link` 标签来为应用程序定义样式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "###STYLESCONFIGURATION", - "original": "### Styles configuration", - "translation": "### 样式配置", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "WITHTHEANGULARCLIYOUCANCONFIGUREYOURGLOBALSTYLESINTHEANGULARJSONFILEYOUCANRENAMETHEEXTENSIONTOSCSSTOUSESASS", - "original": "With the Angular CLI, you can configure your global styles in the `angular.json` file.\n You can rename the extension to `.scss` to use sass.", - "translation": "使用 Angular CLI,你可以在 `angular.json` 文件中配置全局样式。\n 也可以把扩展名改为 `.scss` 来使用 sass。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "INANGULARYOUCANUSETHESTYLESORSTYLEURLSPROPERTYOFTHECOMPONENTMETADATATODEFINEASTYLESHEETFORAPARTICULARCOMPONENT", - "original": "In Angular, you can use the `styles` or `styleUrls` property of the `@Component` metadata to define\n a style sheet for a particular component.", - "translation": "在 Angular 中,你可以在 `@Component` 的元数据中使用 `styles` 或 `styleUrls` 属性来为一个特定的组件定义样式表。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "THISALLOWSYOUTOSETAPPROPRIATESTYLESFORINDIVIDUALCOMPONENTSTHATWONTLEAKINTOOTHERPARTSOFTHEAPPLICATION", - "original": "This allows you to set appropriate styles for individual components that won’t leak into\n other parts of the application.", - "translation": "这让你可以为各个组件设置合适的样式,而不用担心它被泄漏到程序中的其它部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" - }, - { - "key": "#ANIMATIONS", - "original": "# Animations", - "translation": "# 动画", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "MOTIONISANIMPORTANTASPECTINTHEDESIGNOFMODERNWEBAPPLICATIONSGOODUSERINTERFACESTRANSITIONSMOOTHLYBETWEENSTATESWITHENGAGINGANIMATIONSTHATCALLATTENTIONWHEREITSNEEDEDWELLDESIGNEDANIMATIONSCANMAKEAUINOTONLYMOREFUNBUTALSOEASIERTOUSE", - "original": "Motion is an important aspect in the design of modern web applications. Good\nuser interfaces transition smoothly between states with engaging animations\nthat call attention where it's needed. Well-designed animations can make a UI not only\nmore fun but also easier to use.", - "translation": "动画是现代 Web 应用设计中一个很重要的方面。好的用户界面要能在不同的状态之间更平滑的转场。如果需要,还可以用适当的动画来吸引注意力。\n设计良好的动画不但会让 UI 更有趣,还会让它更容易使用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##OVERVIEW", - "original": "## Overview", - "translation": "## 概览", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ANGULARSANIMATIONSYSTEMLETSYOUBUILDANIMATIONSTHATRUNWITHTHESAMEKINDOFNATIVEPERFORMANCEFOUNDINPURECSSANIMATIONSYOUCANALSOTIGHTLYINTEGRATEYOURANIMATIONLOGICWITHTHERESTOFYOURAPPLICATIONCODEFOREASEOFCONTROL", - "original": "Angular's animation system lets you build animations that run with the same kind of native\nperformance found in pure CSS animations. You can also tightly integrate your\nanimation logic with the rest of your application code, for ease of control.", - "translation": "Angular 的动画系统赋予了制作各种动画效果的能力,以构建出与原生 CSS 动画性能相同的动画。\n你还获得了额外的让动画逻辑与其它应用代码紧紧集成在一起的能力,这让动画可以被更容易的触发与控制。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ANGULARANIMATIONSAREBUILTONTOPOFTHESTANDARDWEBANIMATIONSAPIHTTPS:W3CGITHUBIOWEBANIMATIONSANDRUNNATIVELYONBROWSERSTHATSUPPORTITHTTP:CANIUSECOM#FEATWEBANIMATION", - "original": "Angular animations are built on top of the standard [Web Animations API](https://w3c.github.io/web-animations/)\nand run natively on [browsers that support it](http://caniuse.com/#feat=web-animation).", - "translation": "Angular 动画是基于标准的[Web 动画 API(Web Animations API)](https://w3c.github.io/web-animations/)构建的,它们在[支持此 API 的浏览器中](http://caniuse.com/#feat=web-animation)会用原生方式工作。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ASOFANGULAR6IFTHEWEBANIMATIONSAPIISNOTSUPPORTEDNATIVELYBYTHEBROWSERTHENANGULARWILLUSECSSKEYFRAMESASAFALLBACKINSTEADAUTOMATICALLYTHISMEANSTHATTHEPOLYFILLISNOLONGERREQUIREDUNLESSANYCODEUSESANIMATIONBUILDERAPIANIMATIONSANIMATIONBUILDERIFYOURCODEDOESUSEANIMATIONBUILDERTHENUNCOMMENTTHEWEBANIMATIONSJSPOLYFILLFROMTHEPOLYFILLSTSFILEGENERATEDBYANGULARCLI", - "original": "As of Angular 6, If the Web Animations API is not supported natively by the browser, then Angular will use CSS\nkeyframes as a fallback instead (automatically). This means that the polyfill is no longer required unless any\ncode uses [AnimationBuilder](/api/animations/AnimationBuilder). If your code does use AnimationBuilder, then\nuncomment the `web-animations-js` polyfill from the `polyfills.ts` file generated by Angular CLI.", - "translation": "对于 Angular 6,如果浏览器没有提供对 Web 动画 API 的原生支持,Angular 就会自动改用 CSS 的关键帧动画作为后备实现。这意味,除非要在代码中使用 [AnimationBuilder](/api/animations/AnimationBuilder) ,否则不必使用相关的腻子脚本。\n如果你要在代码中使用 AnimationBuilder ,就要从 Angular CLI 自动生成的 `polyfills.ts` 文件中反注释掉 `web-animations-js` 腻子脚本。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THEEXAMPLESINTHISPAGEAREAVAILABLEASALIVEEXAMPLELIVEEXAMPLE", - "original": "The examples in this page are available as a .", - "translation": "本章中引用的这个例子可以到去体验。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##SETUP", - "original": "## Setup", - "translation": "## 准备工作", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "BEFOREYOUCANADDANIMATIONSTOYOURAPPLICATIONYOUNEEDTOIMPORTAFEWANIMATIONSPECIFICMODULESANDFUNCTIONSTOTHEROOTAPPLICATIONMODULE", - "original": "Before you can add animations to your application, you need\nto import a few animation-specific modules and functions to the root application module.", - "translation": "在往应用中添加动画之前,你要首先在应用的根模块中引入一些与动画有关的模块和函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "####EXAMPLEBASICS", - "original": "#### Example basics", - "translation": "#### 基本例子", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THEANIMATIONSEXAMPLESINTHISGUIDEANIMATEALISTOFHEROES", - "original": "The animations examples in this guide animate a list of heroes.", - "translation": "这里的动画例子用来给英雄列表添加动画。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "AHEROCLASSHASANAMEPROPERTYASTATEPROPERTYTHATINDICATESIFTHEHEROISACTIVEORNOTANDATOGGLESTATEMETHODTOSWITCHBETWEENTHESTATES", - "original": "A `Hero` class has a `name` property, a `state` property that indicates if the hero is active or not,\nand a `toggleState()` method to switch between the states.", - "translation": "`Hero` 类有一个 `name` 属性、一个 `state` 属性(用于表明该英雄是否为激活状态)和一个 `toggleState()` 函数,用来在这两种状态之间切换。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ACROSSTHETOPOFTHESCREENAPPHEROTEAMBUILDERCOMPONENTTSAREASERIESOFBUTTONSTHATADDANDREMOVEHEROESFROMTHELISTVIATHEHEROSERVICETHEBUTTONSTRIGGERCHANGESTOTHELISTTHATALLOFTHEEXAMPLECOMPONENTSSEEATTHESAMETIME", - "original": "Across the top of the screen (`app.hero-team-builder.component.ts`)\nare a series of buttons that add and remove heroes from the list (via the `HeroService`). \nThe buttons trigger changes to the list that all of the example components see at the same time.", - "translation": "在屏幕的顶部(`app.hero-team-builder.component.ts`)是一系列按钮,用于从列表中添加和删除英雄(通过 `HeroService`)。\n这些按钮会引起列表的变化,同时可以看到列表中的所有范例组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##TRANSITIONINGBETWEENTWOSTATES", - "original": "## Transitioning between two states", - "translation": "## 快速起步范例:在两个状态间转场", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "YOUCANBUILDASIMPLEANIMATIONTHATTRANSITIONSANELEMENTBETWEENTWOSTATESDRIVENBYAMODELATTRIBUTE", - "original": "You can build a simple animation that transitions an element between two states\ndriven by a model attribute.", - "translation": "你可以构建一个简单的动画,它会让一个元素用模型驱动的方式在两个状态之间转场。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ANIMATIONSCANBEDEFINEDINSIDECOMPONENTMETADATA", - "original": "Animations can be defined inside `@Component` metadata.", - "translation": "动画会被定义在 `@Component` 元数据中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "WITHTHESEYOUCANDEFINEANANIMATIONTRIGGERCALLEDHEROSTATEINTHECOMPONENTMETADATAITUSESANIMATIONSTOTRANSITIONBETWEENTWOSTATES:ACTIVEANDINACTIVEWHENAHEROISACTIVETHEELEMENTAPPEARSINASLIGHTLYLARGERSIZEANDLIGHTERCOLOR", - "original": "With these, you can define an *animation trigger* called `heroState` in the component\nmetadata. It uses animations to transition between two states: `active` and `inactive`. When a\nhero is active, the element appears in a slightly larger size and lighter color.", - "translation": "通过这些,可以在组件元数据中定义一个名叫 `heroState` 的*动画触发器*。它在两个状态 `active` 和 `inactive` 之间进行转场。\n当英雄处于激活状态时,它会把该元素显示得稍微大一点、亮一点。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "INTHISEXAMPLEYOUAREDEFININGANIMATIONSTYLESCOLORANDTRANSFORMINLINEINTHEANIMATIONMETADATA", - "original": "In this example, you are defining animation styles (color and transform) inline in the\nanimation metadata.", - "translation": "在这个例子中,你在元数据中用内联的方式定义了动画样式(`color` 和 `transform`)。在即将到来的一个 Angular 版本中,还将支持从组件的 CSS 样式表中提取样式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "NOWUSINGTHETRIGGERNAMESYNTAXATTACHTHEANIMATIONTHATYOUJUSTDEFINEDTOONEORMOREELEMENTSINTHECOMPONENTSTEMPLATE", - "original": "Now, using the `[@triggerName]` syntax, attach the animation that you just defined to\none or more elements in the component's template.", - "translation": "现在,使用 `[@triggerName]` 语法来把刚刚定义的动画附加到组件模板中一个或多个元素上。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "HERETHEANIMATIONTRIGGERAPPLIESTOEVERYELEMENTREPEATEDBYANNGFOREACHOFTHEREPEATEDELEMENTSANIMATESINDEPENDENTLYTHEVALUEOFTHEATTRIBUTEISBOUNDTOTHEEXPRESSIONHEROSTATEANDISALWAYSEITHERACTIVEORINACTIVE", - "original": "Here, the animation trigger applies to every element repeated by an `ngFor`. Each of\nthe repeated elements animates independently. The value of the\nattribute is bound to the expression `hero.state` and is always either `active` or `inactive`.", - "translation": "这里,动画触发器被添加到了由 `ngFor` 重复出来的每一个元素上。每个重复出来的元素都有独立的动画效果。\n然后把 `@triggerName` 属性(Attribute)的值设置成表达式 `hero.state`。这个值应该是 `inactive` 或 `active` 之一。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "WITHTHISSETUPANANIMATEDTRANSITIONAPPEARSWHENEVERAHEROOBJECTCHANGESSTATEHERESTHEFULLCOMPONENTIMPLEMENTATION:", - "original": "With this setup, an animated transition appears whenever a hero object changes state.\nHere's the full component implementation:", - "translation": "通过这些设置,一旦英雄对象的状态发生了变化,就会触发一个转场动画。下面是完整的组件实现:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##STATESANDTRANSITIONS", - "original": "## States and transitions", - "translation": "## 状态与转场", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ANGULARANIMATIONSAREDEFINEDASLOGICALSTATESANDTRANSITIONSBETWEENSTATES", - "original": "Angular animations are defined as logical **states** and **transitions**\nbetween states.", - "translation": "Angular 动画是由**状态**和**状态之间的转场效果**所定义的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ANANIMATIONSTATEISASTRINGVALUETHATYOUDEFINEINYOURAPPLICATIONCODEINTHEEXAMPLEABOVETHESTATESACTIVEANDINACTIVEAREBASEDONTHELOGICALSTATEOFHEROOBJECTSTHESOURCEOFTHESTATECANBEASIMPLEOBJECTATTRIBUTEASITWASINTHISCASEORITCANBEAVALUECOMPUTEDINAMETHODTHEIMPORTANTTHINGISTHATYOUCANREADITINTOTHECOMPONENTSTEMPLATE", - "original": "An animation state is a string value that you define in your application code. In the example\nabove, the states `'active'` and `'inactive'` are based on the logical state of\nhero objects. The source of the state can be a simple object attribute, as it was in this case,\nor it can be a value computed in a method. The important thing is that you can read it into the\ncomponent's template.", - "translation": "动画状态是一个由程序代码中定义的字符串值。在上面的例子中,`'active'` 和 `'inactive'` 是基于英雄对象的逻辑状态的。\n状态的来源可以是像本例中这样简单的对象属性,也可以是由方法计算出来的值。重点是,你要能从组件模板中读取它。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "YOUCANDEFINESTYLESFOREACHANIMATIONSTATE:", - "original": "You can define *styles* for each animation state:", - "translation": "你可以为每个动画状态定义了*一组样式*:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THESESTATEDEFINITIONSSPECIFYTHEENDSTYLESOFEACHSTATETHEYAREAPPLIEDTOTHEELEMENTONCEITHASTRANSITIONEDTOTHATSTATEANDSTAYASLONGASITREMAINSINTHATSTATEINEFFECTYOUREDEFININGWHATSTYLESTHEELEMENTHASINDIFFERENTSTATES", - "original": "These `state` definitions specify the *end styles* of each state.\nThey are applied to the element once it has transitioned to that state, and stay\n*as long as it remains in that state*. In effect, you're defining what styles the element has in different states.", - "translation": "这些 `state` 具体定义了每个状态的*最终样式*。一旦元素转场到那个状态,该样式就会被应用到此元素上,*当它留在此状态时*,这些样式也会一直保持着。\n从这个意义上讲,这里其实并不只是在定义动画,而是在定义该元素在不同状态时应该具有的样式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "AFTERYOUDEFINESTATESYOUCANDEFINETRANSITIONSBETWEENTHESTATESEACHTRANSITIONCONTROLSTHETIMINGOFSWITCHINGBETWEENONESETOFSTYLESANDTHENEXT:", - "original": "After you define states, you can define *transitions* between the states. Each transition\ncontrols the timing of switching between one set of styles and the next:", - "translation": "定义完状态,就能定义在状态之间的各种*转场*了。每个转场都会控制一条在一组样式和下一组样式之间切换的时间线:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "IFSEVERALTRANSITIONSHAVETHESAMETIMINGCONFIGURATIONYOUCANCOMBINETHEMINTOTHESAMETRANSITIONDEFINITION:", - "original": "If several transitions have the same timing configuration, you can combine\nthem into the same `transition` definition:", - "translation": "如果多个转场都有同样的时间线配置,就可以把它们合并进同一个 `transition` 定义中:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "WHENBOTHDIRECTIONSOFATRANSITIONHAVETHESAMETIMINGASINTHEPREVIOUSEXAMPLEYOUCANUSETHESHORTHANDSYNTAX:", - "original": "When both directions of a transition have the same timing, as in the previous\nexample, you can use the shorthand syntax `<=>`:", - "translation": "如果要对同一个转场的两个方向都使用相同的时间线(就像前面的例子中那样),就可以使用 `<=>` 这种简写语法:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "YOUCANALSOAPPLYASTYLEDURINGANANIMATIONBUTNOTKEEPITAROUNDAFTERTHEANIMATIONFINISHESYOUCANDEFINESUCHSTYLESINLINEINTHETRANSITIONINTHISEXAMPLETHEELEMENTRECEIVESONESETOFSTYLESIMMEDIATELYANDISTHENANIMATEDTOTHENEXTWHENTHETRANSITIONFINISHESNONEOFTHESESTYLESAREKEPTBECAUSETHEYRENOTDEFINEDINASTATE", - "original": "You can also apply a style during an animation but not keep it around\nafter the animation finishes. You can define such styles inline, in the `transition`. In this example,\nthe element receives one set of styles immediately and is then animated to the next.\nWhen the transition finishes, none of these styles are kept because they're not\ndefined in a `state`.", - "translation": "有时希望一些样式只在动画期间生效,但在结束后并不保留它们。这时可以把这些样式内联在 `transition` 中进行定义。\n在这个例子中,该元素会立刻获得一组样式,然后动态转场到下一个状态。当转场结束时,这些样式并不会被保留,因为它们并没有被定义在 `state` 中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "###THEWILDCARDSTATE", - "original": "### The wildcard state `*`", - "translation": "### `*`(通配符)状态", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THEWILDCARDSTATEMATCHESANYANIMATIONSTATETHISISUSEFULFORDEFININGSTYLESANDTRANSITIONSTHATAPPLYREGARDLESSOFWHICHSTATETHEANIMATIONISINFOREXAMPLE:", - "original": "The `*` (\"wildcard\") state matches *any* animation state. This is useful for defining styles and\ntransitions that apply regardless of which state the animation is in. For example:", - "translation": "`*`(通配符)状态匹配*任何*动画状态。当定义那些不需要管当前处于什么状态的样式及转场时,这很有用。比如:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THEACTIVETRANSITIONAPPLIESWHENTHEELEMENTSSTATECHANGESFROMACTIVETOANYTHINGELSE", - "original": "* The `active => *` transition applies when the element's state changes from `active` to anything else.", - "translation": "当该元素的状态从 `active` 变成任何其它状态时,`active => *` 转场都会生效。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THETRANSITIONAPPLIESWHENANYCHANGEBETWEENTWOSTATESTAKESPLACE", - "original": "* The `* => *` transition applies when *any* change between two states takes place.", - "translation": "当在*任意*两个状态之间切换时,`* => *` 转场都会生效。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "###THEVOIDSTATE", - "original": "### The `void` state", - "translation": "### `void` 状态", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THESPECIALSTATECALLEDVOIDCANAPPLYTOANYANIMATIONITAPPLIESWHENTHEELEMENTISNOTATTACHEDTOAVIEWPERHAPSBECAUSEITHASNOTYETBEENADDEDORBECAUSEITHASBEENREMOVEDTHEVOIDSTATEISUSEFULFORDEFININGENTERANDLEAVEANIMATIONS", - "original": "The special state called `void` can apply to any animation. It applies\nwhen the element is *not* attached to a view, perhaps because it has not yet been\nadded or because it has been removed. The `void` state is useful for defining enter and\nleave animations.", - "translation": "有一种叫做 `void` 的特殊状态,它可以应用在任何动画中。它表示元素*没有*被附加到视图。这种情况可能是由于它尚未被添加进来或者已经被移除了。\n`void` 状态在定义“进场”和“离场”的动画时会非常有用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "FOREXAMPLETHEVOIDTRANSITIONAPPLIESWHENTHEELEMENTLEAVESTHEVIEWREGARDLESSOFWHATSTATEITWASINBEFOREITLEFT", - "original": "For example the `* => void` transition applies when the element leaves the view,\nregardless of what state it was in before it left.", - "translation": "比如当一个元素离开视图时,`* => void` 转场就会生效,而不管它在离场以前是什么状态。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THEWILDCARDSTATEALSOMATCHESVOID", - "original": "The wildcard state `*` also matches `void`.", - "translation": "`*` 通配符状态也能匹配 `void`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##EXAMPLE:ENTERINGANDLEAVING", - "original": "## Example: Entering and leaving", - "translation": "## 例子:进场与离场", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "USINGTHEVOIDANDSTATESYOUCANDEFINETRANSITIONSTHATANIMATETHEENTERINGANDLEAVINGOFELEMENTS:", - "original": "Using the `void` and `*` states you can define transitions that animate the\nentering and leaving of elements:", - "translation": "使用 `void` 和 `*` 状态,可以定义元素进场与离场时的转场动画:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ENTER:VOID", - "original": "* Enter: `void => *`", - "translation": "进场:`void => *`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "LEAVE:VOID", - "original": "* Leave: `* => void`", - "translation": "离场:`* => void`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "FOREXAMPLEINTHEANIMATIONSARRAYBELOWTHEREARETWOTRANSITIONSTHATUSETHEVOIDANDVOIDSYNTAXTOANIMATETHEELEMENTINANDOUTOFTHEVIEW", - "original": "For example, in the `animations` array below there are two transitions that use\nthe `void => *` and `* => void` syntax to animate the element in and out of the view.", - "translation": "例如,在下面的 `animations` 数组中,这两个转场语句使用 `void => *` 和 `* => void` 语法来让该元素以动画形式进入和离开当前视图。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "NOTETHATINTHISCASETHESTYLESAREAPPLIEDTOTHEVOIDSTATEDIRECTLYINTHETRANSITIONDEFINITIONSANDNOTINASEPARATESTATEVOIDDEFINITIONTHUSTHETRANSFORMSAREDIFFERENTONENTERANDLEAVE:THEELEMENTENTERSFROMTHELEFTANDLEAVESTOTHERIGHT", - "original": "Note that in this case the styles are applied to the void state directly in the\ntransition definitions, and not in a separate `state(void)` definition. Thus, the transforms\nare different on enter and leave: the element enters from the left\nand leaves to the right.", - "translation": "注意,在这个例子中,这些样式在转场定义中被直接应用到了 `void` 状态,但并没有一个单独的 `state(void)` 定义。\n这么做是因为希望在进场与离场时使用不一样的转换效果:元素从左侧进场,从右侧离开。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THESETWOCOMMONANIMATIONSHAVETHEIROWNALIASES:", - "original": "These two common animations have their own aliases:", - "translation": "这两个常见的动画有自己的别名:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##EXAMPLE:ENTERINGANDLEAVINGFROMDIFFERENTSTATES", - "original": "## Example: Entering and leaving from different states", - "translation": "## 范例:从不同的状态下进场和离场", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "YOUCANALSOCOMBINETHISANIMATIONWITHTHEEARLIERSTATETRANSITIONANIMATIONBYUSINGTHEHEROSTATEASTHEANIMATIONSTATETHISLETSYOUCONFIGUREDIFFERENTTRANSITIONSFORENTERINGANDLEAVINGBASEDONWHATTHESTATEOFTHEHEROIS:", - "original": "You can also combine this animation with the earlier state transition animation by\nusing the hero state as the animation state. This lets you configure\ndifferent transitions for entering and leaving based on what the state of the hero\nis:", - "translation": "通过把英雄的状态用作动画的状态,还能把该动画跟以前的转场动画组合成一个复合动画。这让你能根据该英雄的当前状态为其配置不同的进场与离场动画:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "INACTIVEHEROENTER:VOIDINACTIVE", - "original": "* Inactive hero enter: `void => inactive`", - "translation": "非激活英雄进场:`void => inactive`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ACTIVEHEROENTER:VOIDACTIVE", - "original": "* Active hero enter: `void => active`", - "translation": "激活英雄进场:`void => active`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "INACTIVEHEROLEAVE:INACTIVEVOID", - "original": "* Inactive hero leave: `inactive => void`", - "translation": "非激活英雄离场:`inactive => void`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ACTIVEHEROLEAVE:ACTIVEVOID", - "original": "* Active hero leave: `active => void`", - "translation": "激活英雄离场:`active => void`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THISGIVESYOUFINEGRAINEDCONTROLOVEREACHTRANSITION:", - "original": "This gives you fine-grained control over each transition:", - "translation": "现在就对每一种转场都有了细粒度的控制:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##ANIMATABLEPROPERTIESANDUNITS", - "original": "## Animatable properties and units", - "translation": "## 可动的(Animatable)属性与单位", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "SINCEANGULARSANIMATIONSUPPORTBUILDSONTOPOFWEBANIMATIONSYOUCANANIMATEANYPROPERTYTHATTHEBROWSERCONSIDERSANIMATABLETHISINCLUDESPOSITIONSSIZESTRANSFORMSCOLORSBORDERSANDMANYOTHERSTHEW3CMAINTAINSALISTOFANIMATABLEPROPERTIESHTTPS:WWWW3ORGTRCSS3TRANSITIONS#ANIMATABLEPROPERTIESONITSCSSTRANSITIONSPAGEHTTPS:WWWW3ORGTRCSS3TRANSITIONS", - "original": "Since Angular's animation support builds on top of Web Animations, you can animate any property\nthat the browser considers *animatable*. This includes positions, sizes, transforms, colors,\nborders, and many others. The W3C maintains\n[a list of animatable properties](https://www.w3.org/TR/css3-transitions/#animatable-properties)\non its [CSS Transitions page](https://www.w3.org/TR/css3-transitions).", - "translation": "由于 Angular 的动画支持是基于 Web Animations 标准的,所以也能支持浏览器认为可以*参与动画*的任何属性。这些属性包括位置(position)、大小(size)、变换(transform)、颜色(color)、边框(border)等很多属性。W3C 维护着\n[一个“可动”属性列表](https://www.w3.org/TR/css3-transitions/#animatable-properties)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "FORPOSITIONALPROPERTIESTHATHAVEANUMERICVALUEYOUCANDEFINEAUNITBYPROVIDINGTHEVALUEASASTRINGWITHTHEAPPROPRIATESUFFIX:", - "original": "For positional properties that have a numeric value, you can define a unit by providing\nthe value as a string with the appropriate suffix:", - "translation": "尺寸类属性(如位置、大小、边框等)包括一个数字值和一个用来定义长度单位的后缀:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "IFYOUDONTPROVIDEAUNITWHENSPECIFYINGDIMENSIONANGULARASSUMESTHEDEFAULTOFPX:", - "original": "If you don't provide a unit when specifying dimension, Angular assumes the default of `px`:", - "translation": "对大多数尺寸类属性而言,还能只定义一个数字,那就表示它使用的是像素(px)数:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "50ISTHESAMEASSAYING50PX", - "original": "* `50` is the same as saying `'50px'`", - "translation": "`50` 相当于 `'50px'`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##AUTOMATICPROPERTYCALCULATION", - "original": "## Automatic property calculation", - "translation": "## 自动属性值计算", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "SOMETIMESYOUDONTKNOWTHEVALUEOFADIMENSIONALSTYLEPROPERTYUNTILRUNTIMEFOREXAMPLEELEMENTSOFTENHAVEWIDTHSANDHEIGHTSTHATDEPENDONTHEIRCONTENTANDTHESCREENSIZETHESEPROPERTIESAREOFTENTRICKYTOANIMATEWITHCSS", - "original": "Sometimes you don't know the value of a dimensional style property until runtime.\nFor example, elements often have widths and heights that\ndepend on their content and the screen size. These properties are often tricky\nto animate with CSS.", - "translation": "有时候,你在开始运行之前都无法知道某个样式属性的值。比如,元素的宽度和高度往往依赖于它们的内容和屏幕的尺寸。处理这些属性对 CSS 动画而言通常是相当棘手的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "INTHESECASESYOUCANUSEASPECIALPROPERTYVALUESOTHATTHEVALUEOFTHEPROPERTYISCOMPUTEDATRUNTIMEANDTHENPLUGGEDINTOTHEANIMATION", - "original": "In these cases, you can use a special `*` property value so that the value of the\nproperty is computed at runtime and then plugged into the animation.", - "translation": "如果用 Angular 动画,就可以用一个特殊的 `*` 属性值来处理这种情况。该属性的值将会在运行期被计算出来,然后插入到这个动画中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "INTHISEXAMPLETHELEAVEANIMATIONTAKESWHATEVERHEIGHTTHEELEMENTHASBEFOREITLEAVESANDANIMATESFROMTHATHEIGHTTOZERO:", - "original": "In this example, the leave animation takes whatever height the element has before it\nleaves and animates from that height to zero:", - "translation": "这个例子中的“离场”动画会取得该元素在离场前的高度,并且把它从这个高度用动画转场到 0 高度:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##ANIMATIONTIMING", - "original": "## Animation timing", - "translation": "## 动画时间线", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THEREARETHREETIMINGPROPERTIESYOUCANTUNEFOREVERYANIMATEDTRANSITION:THEDURATIONTHEDELAYANDTHEEASINGFUNCTIONTHEYAREALLCOMBINEDINTOASINGLETRANSITIONTIMINGSTRING", - "original": "There are three timing properties you can tune for every animated transition:\nthe duration, the delay, and the easing function. They are all combined into\na single transition *timing string*.", - "translation": "对每一个动画转场效果,有三种时间线属性可以调整:持续时间(duration)、延迟(delay)和缓动(easing)函数。它们被合并到了一个单独的*转场时间线字符串*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "###DURATION", - "original": "### Duration", - "translation": "### 持续时间", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THEDURATIONCONTROLSHOWLONGTHEANIMATIONTAKESTORUNFROMSTARTTOFINISHYOUCANDEFINEADURATIONINTHREEWAYS:", - "original": "The duration controls how long the animation takes to run from start to finish.\nYou can define a duration in three ways:", - "translation": "持续时间控制动画从开始到结束要花多长时间。可以用三种方式定义持续时间:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ASAPLAINNUMBERINMILLISECONDS:100", - "original": "* As a plain number, in milliseconds: `100`", - "translation": "作为一个普通数字,以毫秒为单位,如:`100`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "INASTRINGASMILLISECONDS:100MS", - "original": "* In a string, as milliseconds: `'100ms'`", - "translation": "作为一个字符串,以毫秒为单位,如:`'100ms'`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "INASTRINGASSECONDS:01S", - "original": "* In a string, as seconds: `'0.1s'`", - "translation": "作为一个字符串,以秒为单位,如:`'0.1s'`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "###DELAY", - "original": "### Delay", - "translation": "### 延迟", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THEDELAYCONTROLSTHELENGTHOFTIMEBETWEENTHEANIMATIONTRIGGERANDTHEBEGINNINGOFTHETRANSITIONYOUCANDEFINEONEBYADDINGITTOTHESAMESTRINGFOLLOWINGTHEDURATIONITALSOHASTHESAMEFORMATOPTIONSASTHEDURATION:", - "original": "The delay controls the length of time between the animation trigger and the beginning\nof the transition. You can define one by adding it to the same string\nfollowing the duration. It also has the same format options as the duration:", - "translation": "延迟控制的是在动画已经触发但尚未真正开始转场之前要等待多久。可以把它添加到字符串中的持续时间后面,它的选项格式也跟持续时间是一样的:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "WAITFOR100MSANDTHENRUNFOR200MS:02S100MS", - "original": "* Wait for 100ms and then run for 200ms: `'0.2s 100ms'`", - "translation": "等待 100 毫秒,然后运行 200 毫秒:`'0.2s 100ms'`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "###EASING", - "original": "### Easing", - "translation": "### 缓动函数", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THEEASINGFUNCTIONHTTP:EASINGSNETCONTROLSHOWTHEANIMATIONACCELERATESANDDECELERATESDURINGITSRUNTIMEFOREXAMPLEANEASEINFUNCTIONCAUSESTHEANIMATIONTOBEGINRELATIVELYSLOWLYBUTPICKUPSPEEDASITPROGRESSESYOUCANCONTROLTHEEASINGBYADDINGITASATHIRDVALUEINTHESTRINGAFTERTHEDURATIONANDTHEDELAYORASTHESECONDVALUEWHENTHEREISNODELAY:", - "original": "The [easing function](http://easings.net/) controls how the animation accelerates\nand decelerates during its runtime. For example, an `ease-in` function causes\nthe animation to begin relatively slowly but pick up speed as it progresses. You\ncan control the easing by adding it as a *third* value in the string after the duration\nand the delay (or as the *second* value when there is no delay):", - "translation": "[缓动函数](http://easings.net/)用于控制动画在运行期间如何加速和减速。比如:使用 `ease-in` 函数意味着动画开始时相对缓慢,然后在进行中逐步加速。可以通过在这个字符串中的持续时间和延迟后面添加*第三个*值来控制使用哪个缓动函数(如果没有定义延迟就作为*第二个*值)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "WAITFOR100MSANDTHENRUNFOR200MSWITHEASING:02S100MSEASEOUT", - "original": "* Wait for 100ms and then run for 200ms, with easing: `'0.2s 100ms ease-out'`", - "translation": "等待 100 毫秒,然后运行 200 毫秒,并且带缓动:`'0.2s 100ms ease-out'`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "RUNFOR200MSWITHEASING:02SEASEINOUT", - "original": "* Run for 200ms, with easing: `'0.2s ease-in-out'`", - "translation": "运行 200 毫秒,并且带缓动:`'0.2s ease-in-out'`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "###EXAMPLE", - "original": "### Example", - "translation": "### 例子", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "HEREAREACOUPLEOFCUSTOMTIMINGSINACTIONBOTHENTERANDLEAVELASTFOR200MILLISECONDSTHATIS02SBUTTHEYHAVEDIFFERENTEASINGSTHELEAVEBEGINSAFTERASLIGHTDELAYOF10MILLISECONDSASSPECIFIEDIN02S10EASEOUT:", - "original": "Here are a couple of custom timings in action. Both enter and leave last for\n200 milliseconds, that is `0.2s`, but they have different easings. The leave begins after a\nslight delay of 10 milliseconds as specified in `'0.2s 10 ease-out'`:", - "translation": "这里是两个自定义时间线的动态演示。“进场”和“离场”都持续 200 毫秒,也就是 `0.2s`,但它们有不同的缓动函数。“离场”动画会在 100 毫秒的延迟之后开始,也就是 `'0.2s 10 ease-out'`:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##MULTISTEPANIMATIONSWITHKEYFRAMES", - "original": "## Multi-step animations with keyframes", - "translation": "## 基于关键帧(Keyframes)的多阶段动画", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ANIMATIONKEYFRAMESGOBEYONDASIMPLETRANSITIONTOAMOREINTRICATEANIMATIONTHATGOESTHROUGHONEORMOREINTERMEDIATESTYLESWHENTRANSITIONINGBETWEENTWOSETSOFSTYLES", - "original": "Animation *keyframes* go beyond a simple transition to a more intricate animation\nthat goes through one or more intermediate styles when transitioning between two sets of styles.", - "translation": "通过定义动画的*关键帧*,可以把两组样式之间的简单转场,升级成一种更复杂的动画,它会在转场期间经历一个或多个中间样式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "FOREACHKEYFRAMEYOUSPECIFYANOFFSETTHATDEFINESATWHICHPOINTINTHEANIMATIONTHATKEYFRAMEAPPLIESTHEOFFSETISANUMBERBETWEENZEROWHICHMARKSTHEBEGINNINGOFTHEANIMATIONANDONEWHICHMARKSTHEEND", - "original": "For each keyframe, you specify an *offset* that defines at which point\nin the animation that keyframe applies. The offset is a number between zero,\nwhich marks the beginning of the animation, and one, which marks the end.", - "translation": "每个关键帧都可以被指定一个*偏移量*,用来定义该关键帧将被用在动画期间的哪个时间点。偏移量是一个介于 0(表示动画起点)和 1(表示动画终点)之间的数组。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THISEXAMPLEADDSSOMEBOUNCETOTHEENTERANDLEAVEANIMATIONSWITHKEYFRAMES:", - "original": "This example adds some \"bounce\" to the enter and leave animations with\nkeyframes:", - "translation": "这个例子使用关键帧来为进场和离场动画添加一些“反弹效果”:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "NOTETHATTHEOFFSETSARENOTDEFINEDINTERMSOFABSOLUTETIMETHEYARERELATIVEMEASURESFROMZEROTOONETHEFINALTIMELINEOFTHEANIMATIONISBASEDONTHECOMBINATIONOFKEYFRAMEOFFSETSDURATIONDELAYANDEASING", - "original": "Note that the offsets are *not* defined in terms of absolute time. They are relative\nmeasures from zero to one. The final timeline of the animation is based on the combination\nof keyframe offsets, duration, delay, and easing.", - "translation": "注意,这个偏移量并*不是*用绝对数字定义的时间段,而是在 0 到 1 之间的相对值(百分比)。动画的最终时间线会基于关键帧的偏移量、持续时间、延迟和缓动函数计算出来。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "DEFININGOFFSETSFORKEYFRAMESISOPTIONALIFYOUOMITTHEMOFFSETSWITHEVENSPACINGAREAUTOMATICALLYASSIGNEDFOREXAMPLETHREEKEYFRAMESWITHOUTPREDEFINEDOFFSETSRECEIVEOFFSETS005AND1", - "original": "Defining offsets for keyframes is optional. If you omit them, offsets with even\nspacing are automatically assigned. For example, three keyframes without predefined\noffsets receive offsets `0`, `0.5`, and `1`.", - "translation": "为关键帧定义偏移量是可选的。如果省略它们,偏移量会自动根据帧数平均分布出来。例如,三个未定义过偏移量的关键帧会分别获得偏移量:`0`、`0.5` 和 `1`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##PARALLELANIMATIONGROUPS", - "original": "## Parallel animation groups", - "translation": "## 并行动画组(Group)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "YOUVESEENHOWTOANIMATEMULTIPLESTYLEPROPERTIESATTHESAMETIME:JUSTPUTALLOFTHEMINTOTHESAMESTYLEDEFINITION", - "original": "You've seen how to animate multiple style properties at the same time:\njust put all of them into the same `style()` definition.", - "translation": "你已经知道该如何在同一时间段进行多个样式的动画了:只要把它们都放进同一个 `style()` 定义中就行了!", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "BUTYOUMAYALSOWANTTOCONFIGUREDIFFERENTTIMINGSFORANIMATIONSTHATHAPPENINPARALLELFOREXAMPLEYOUMAYWANTTOANIMATETWOCSSPROPERTIESBUTUSEADIFFERENTEASINGFUNCTIONFOREACHONE", - "original": "But you may also want to configure different *timings* for animations that happen\nin parallel. For example, you may want to animate two CSS properties but use a\ndifferent easing function for each one.", - "translation": "但你也可能会希望为同时发生的几个动画配置不同的*时间线*。比如,同时对两个 CSS 属性做动画,但又得为它们定义不同的缓动函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "FORTHISYOUCANUSEANIMATIONGROUPSINTHISEXAMPLEUSINGGROUPSBOTHONENTERANDLEAVEALLOWSFORTWODIFFERENTTIMINGCONFIGURATIONSBOTHAREAPPLIEDTOTHESAMEELEMENTINPARALLELBUTRUNINDEPENDENTLYOFEACHOTHER:", - "original": "For this you can use animation *groups*. In this example, using groups both on\nenter and leave allows for two different timing configurations. Both\nare applied to the same element in parallel, but run independently of each other:", - "translation": "这种情况下就可以用动画*组*来解决了。在这个例子中,同时在进场和离场时使用了组,以便能让它们使用两种不同的时间线配置。\n它们被同时应用到同一个元素上,但又彼此独立运行:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ONEGROUPANIMATESTHEELEMENTTRANSFORMANDWIDTHTHEOTHERGROUPANIMATESTHEOPACITY", - "original": "One group animates the element transform and width; the other group animates the opacity.", - "translation": "其中一个动画组对元素的 `transform` 和 `width` 做动画,另一个组则对 `opacity` 做动画。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "##ANIMATIONCALLBACKS", - "original": "## Animation callbacks", - "translation": "## 动画回调", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "ACALLBACKISFIREDWHENANANIMATIONISSTARTEDANDALSOWHENITISDONE", - "original": "A callback is fired when an animation is started and also when it is done.", - "translation": "当动画开始和结束时,会触发一个回调。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "INTHEKEYFRAMESEXAMPLEYOUHAVEATRIGGERCALLEDFLYINOUTYOUCANHOOKTHOSECALLBACKSLIKETHIS:", - "original": "In the keyframes example, you have a `trigger` called `@flyInOut`. You can hook\nthose callbacks like this:", - "translation": "对于例子中的这个关键帧,你有一个叫做 `@flyInOut` 的 `trigger`。在那里你可以挂钩到那些回调,比如:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THECALLBACKSRECEIVEANANIMATIONEVENTTHATCONTAINSUSEFULPROPERTIESSUCHASFROMSTATETOSTATEANDTOTALTIME", - "original": "The callbacks receive an `AnimationEvent` that contains useful properties such as\n`fromState`, `toState` and `totalTime`.", - "translation": "这些回调接收一个 `AnimationTransitionEvent` 参数,它包含一些有用的属性,例如 `fromState`,`toState` 和 `totalTime`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "THOSECALLBACKSWILLFIREWHETHERORNOTANANIMATIONISPICKEDUP", - "original": "Those callbacks will fire whether or not an animation is picked up.", - "translation": "无论动画是否实际执行过,那些回调都会触发。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" - }, - { - "key": "#THEAHEADOFTIMEAOTCOMPILER", - "original": "# The Ahead-of-Time (AOT) Compiler", - "translation": "# 预先(AOT)编译", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEANGULARAHEADOFTIMEAOTCOMPILERCONVERTSYOURANGULARHTMLANDTYPESCRIPTCODEINTOEFFICIENTJAVASCRIPTCODEDURINGTHEBUILDPHASEBEFORETHEBROWSERDOWNLOADSANDRUNSTHATCODE", - "original": "The Angular Ahead-of-Time (AOT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code during the build phase _before_ the browser downloads and runs that code.", - "translation": "Angular 的“预先(AOT)编译器”会在构建期间把 Angular 应用的 HTML 和 TypeScript 代码编译成高效的 JavaScript 代码,之后浏览器就可以下载并快速运行这些代码。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISGUIDEEXPLAINSHOWTOBUILDWITHTHEAOTCOMPILERUSINGDIFFERENTCOMPILEROPTIONSANDHOWTOWRITEANGULARMETADATATHATAOTCANCOMPILE", - "original": "This guide explains how to build with the AOT compiler using different compiler options and how to write Angular metadata that AOT can compile.", - "translation": "本章描述了如何使用 AOT 编译器,以及如何书写能被 AOT 编译的 Angular 元数据。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "AHREFHTTPS:WWWYOUTUBECOMWATCHVKW9CJSVCSGOWATCHCOMPILERAUTHORTOBIASBOSCHEXPLAINTHEANGULARCOMPILERAATANGULARCONNECT2016", - "original": "Watch compiler author Tobias Bosch explain the Angular Compiler at AngularConnect 2016.", - "translation": "观看编译器作者 Tobias Bosch 在 AngularConnect 2016 大会里,对Angular 编译器的演讲。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##ANGULARCOMPILATION", - "original": "## Angular compilation", - "translation": "## Angular 中的编译", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ANANGULARAPPLICATIONCONSISTSLARGELYOFCOMPONENTSANDTHEIRHTMLTEMPLATESBEFORETHEBROWSERCANRENDERTHEAPPLICATIONTHECOMPONENTSANDTEMPLATESMUSTBECONVERTEDTOEXECUTABLEJAVASCRIPTBYANANGULARCOMPILER", - "original": "An Angular application consists largely of components and their HTML templates.\nBefore the browser can render the application,\nthe components and templates must be converted to executable JavaScript by an _Angular compiler_.", - "translation": "Angular 应用由大量组件及其 HTML 模板组成。\n在浏览器渲染应用之前,组件和模板必须由 *Angular 编译器*转换成可执行的 JavaScript 代码。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ANGULAROFFERSTWOWAYSTOCOMPILEYOURAPPLICATION:", - "original": "Angular offers two ways to compile your application:", - "translation": "Angular 提供了两种方式来编译你的应用:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "1JUSTINTIMEJITWHICHCOMPILESYOURAPPINTHEBROWSERATRUNTIME", - "original": "1. **_Just-in-Time_ (JIT)**, which compiles your app in the browser at runtime", - "translation": "**即时(JIT)编译**,它会在浏览器中运行时编译你的应用", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "1AHEADOFTIMEAOTWHICHCOMPILESYOURAPPATBUILDTIME", - "original": "1. **_Ahead-of-Time_ (AOT)**, which compiles your app at build time.", - "translation": "**预先(AOT)编译**,它会在构建时编译你的应用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "JITCOMPILATIONISTHEDEFAULTWHENYOURUNTHEBUILDONLYORTHEBUILDANDSERVELOCALLYCLICOMMANDS:", - "original": "JIT compilation is the default when you run the _build-only_ or the _build-and-serve-locally_ CLI commands:", - "translation": "当你运行 *`build`* 或 *`serve`* 这两个 CLI 命令时 JIT 编译是默认选项:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "FORAOTCOMPILATIONAPPENDTHEAOTFLAGSTOTHEBUILDONLYORTHEBUILDANDSERVELOCALLYCLICOMMANDS:", - "original": "For AOT compilation, append the `--aot` flags to the _build-only_ or the _build-and-serve-locally_ CLI commands:", - "translation": "要进行 AOT 编译只要给这两个 CLI 命令添加 `--aot` 标志就行了:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEPRODMETAFLAGCOMPILESWITHAOTBYDEFAULT", - "original": "The `--prod` meta-flag compiles with AOT by default.", - "translation": "`--prod` 标志也会默认使用 AOT 编译。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "SEETHECLIDOCUMENTATIONHTTPS:GITHUBCOMANGULARANGULARCLIWIKIFORDETAILSESPECIALLYTHEBUILDTOPICHTTPS:GITHUBCOMANGULARANGULARCLIWIKIBUILD", - "original": "See the [CLI documentation](https://github.com/angular/angular-cli/wiki) for details, especially the [`build` topic](https://github.com/angular/angular-cli/wiki/build).", - "translation": "要了解更多,请参见[CLI 文档](https://github.com/angular/angular-cli/wiki),特别是[`build` 这个主题](https://github.com/angular/angular-cli/wiki/build)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##WHYCOMPILEWITHAOT", - "original": "## Why compile with AOT?", - "translation": "## 为什么需要 AOT 编译?", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "FASTERRENDERING", - "original": "*Faster rendering*", - "translation": "**渲染得更快**", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "WITHAOTTHEBROWSERDOWNLOADSAPRECOMPILEDVERSIONOFTHEAPPLICATIONTHEBROWSERLOADSEXECUTABLECODESOITCANRENDERTHEAPPLICATIONIMMEDIATELYWITHOUTWAITINGTOCOMPILETHEAPPFIRST", - "original": "With AOT, the browser downloads a pre-compiled version of the application.\nThe browser loads executable code so it can render the application immediately, without waiting to compile the app first.", - "translation": "使用 AOT,浏览器下载预编译版本的应用程序。\n浏览器直接加载运行代码,所以它可以立即渲染该应用,而不用等应用完成首次编译。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "FEWERASYNCHRONOUSREQUESTS", - "original": "*Fewer asynchronous requests*", - "translation": "**需要的异步请求更少**", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERINLINESEXTERNALHTMLTEMPLATESANDCSSSTYLESHEETSWITHINTHEAPPLICATIONJAVASCRIPTELIMINATINGSEPARATEAJAXREQUESTSFORTHOSESOURCEFILES", - "original": "The compiler _inlines_ external HTML templates and CSS style sheets within the application JavaScript,\neliminating separate ajax requests for those source files.", - "translation": "编译器把外部 HTML 模板和 CSS 样式表内联到了该应用的 JavaScript 中。\n消除了用来下载那些源文件的 Ajax 请求。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "SMALLERANGULARFRAMEWORKDOWNLOADSIZE", - "original": "*Smaller Angular framework download size*", - "translation": "**需要下载的 Angular 框架体积更小**", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THERESNONEEDTODOWNLOADTHEANGULARCOMPILERIFTHEAPPISALREADYCOMPILEDTHECOMPILERISROUGHLYHALFOFANGULARITSELFSOOMITTINGITDRAMATICALLYREDUCESTHEAPPLICATIONPAYLOAD", - "original": "There's no need to download the Angular compiler if the app is already compiled.\nThe compiler is roughly half of Angular itself, so omitting it dramatically reduces the application payload.", - "translation": "如果应用已经编译过了,自然不需要再下载 Angular 编译器了。\n该编译器差不多占了 Angular 自身体积的一半儿,所以,省略它可以显著减小应用的体积。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "DETECTTEMPLATEERRORSEARLIER", - "original": "*Detect template errors earlier*", - "translation": "**提早检测模板错误**", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEAOTCOMPILERDETECTSANDREPORTSTEMPLATEBINDINGERRORSDURINGTHEBUILDSTEPBEFOREUSERSCANSEETHEM", - "original": "The AOT compiler detects and reports template binding errors during the build step\nbefore users can see them.", - "translation": "AOT 编译器在构建过程中检测和报告模板绑定错误,避免用户遇到这些错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "BETTERSECURITY", - "original": "*Better security*", - "translation": "**更安全**", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "AOTCOMPILESHTMLTEMPLATESANDCOMPONENTSINTOJAVASCRIPTFILESLONGBEFORETHEYARESERVEDTOTHECLIENTWITHNOTEMPLATESTOREADANDNORISKYCLIENTSIDEHTMLORJAVASCRIPTEVALUATIONTHEREAREFEWEROPPORTUNITIESFORINJECTIONATTACKS", - "original": "AOT compiles HTML templates and components into JavaScript files long before they are served to the client.\nWith no templates to read and no risky client-side HTML or JavaScript evaluation,\nthere are fewer opportunities for injection attacks.", - "translation": "AOT 编译远在 HTML 模版和组件被服务到客户端之前,将它们编译到 JavaScript 文件。\n没有模版可以阅读,没有高风险客户端 HTML 或 JavaScript 可利用,所以注入攻击的机会较少。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##ANGULARCOMPILEROPTIONS", - "original": "## Angular Compiler Options", - "translation": "## Angular 编译器选项", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUCANCONTROLYOURAPPCOMPILATIONBYPROVIDINGTEMPLATECOMPILEROPTIONSINTHETSCONFIGJSONFILEALONGWITHTHEOPTIONSSUPPLIEDTOTHETYPESCRIPTCOMPILERTHETEMPLATECOMPILEROPTIONSARESPECIFIEDASMEMBERSOFANGULARCOMPILEROPTIONSOBJECTASSHOWNBELOW:", - "original": "You can control your app compilation by providing template compiler options in the `tsconfig.json` file along with the options supplied to the TypeScript compiler. The template compiler options are specified as members of\n`\"angularCompilerOptions\"` object as shown below:", - "translation": "你可以通过在 `tsconfig.json` 文件中随 TypeScript 编译选项一起提供模板编译选项来控制应用的编译方式。\n这些模板编译选项都是作为 `\"angularCompilerOptions\"` 对象的成员指定的,代码如下:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONTELLSTHECOMPILERNOTTOPRODUCEMETADATAJSONFILESTHEOPTIONISFALSEBYDEFAULT", - "original": "This option tells the compiler not to produce `.metadata.json` files.\nThe option is `false` by default.", - "translation": "这个选项告诉编译器不要生成 `.metadata.json` 文件,它默认是 `false`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "METADATAJSONFILESCONTAININFORMATIONNEEDEDBYTHETEMPLATECOMPILERFROMATSFILETHATISNOTINCLUDEDINTHEDTSFILEPRODUCEDBYTHETYPESCRIPTCOMPILERTHISINFORMATIONCONTAINSFOREXAMPLETHECONTENTOFANNOTATIONSSUCHASACOMPONENTSTEMPLATEWHICHTYPESCRIPTEMITSTOTHEJSFILEBUTNOTTOTHEDTSFILE", - "original": "`.metadata.json` files contain information needed by the template compiler from a `.ts`\nfile that is not included in the `.d.ts` file produced by the TypeScript compiler. This information contains,\nfor example, the content of annotations (such as a component's template) which TypeScript\nemits to the `.js` file but not to the `.d.ts` file.", - "translation": "`.metadata.json` 文件中包含模板编译器所需的信息,这些信息来自于 `.ts` 文件中,但是没有包含在由 TypeScript 编译器生成的 `.d.ts` 文件中。\n比如,这个信息包括 TypeScript 发出的注解内容(如组件的模板),TypeScript 把它生成到了 `.js` 文件中,但是没有生成到 `.d.ts` 文件中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONSHOULDBESETTOTRUEIFUSINGTYPESCRIPTSOUTFILEOPTIONASTHEMETADATAFILESARENOTVALIDFORTHISSTYLEOFTYPESCRIPTOUTPUTITISNOTRECOMMEDEDTOUSEOUTFILEWITHANGULARUSEABUNDLERSUCHASWEBPACKHTTPS:WEBPACKJSORGINSTEAD", - "original": "This option should be set to `true` if using TypeScript's `--outFile` option, as the metadata files\nare not valid for this style of TypeScript output. It is not recommeded to use `--outFile` with\nAngular. Use a bundler, such as [webpack](https://webpack.js.org/), instead.", - "translation": "如果使用了 TypeScript 的 `--outFile` 选项,那就要同时设置这个选项。因为在 TypeScript 的这种输出方式下,metadata 文件是无效的。\nAngular 中不建议使用 `--outFile`,请改用 [webpack](https://webpack.js.org/) 之类的打包器代替。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONCANALSOBESETTOTRUEWHENUSINGFACTORYSUMMARIESASTHEFACTORYSUMMARIESINCLUDEACOPYOFTHEINFORMATIONTHATISINTHEMETADATAJSONFILE", - "original": "This option can also be set to `true` when using factory summaries as the factory summaries\ninclude a copy of the information that is in the `.metadata.json` file.", - "translation": "当使用工厂汇总器(factory summary)时,这个选项也要设置为 `true`,因为工厂汇总器在自己的 `.metadata.json` 中也包含了这些信息的一个副本。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONTELLSTHETEMPLATECOMPILERTOREPORTANERRORTOTHEMETADATAJSONFILEIFSKIPMETADATAEMITISFALSETHISOPTIONISFALSEBYDEFAULTTHISSHOULDONLYBEUSEDWHENSKIPMETADATAEMITISFALSEANDSKIPTEMPLATECODEGENISTRUE", - "original": "This option tells the template compiler to report an error to the `.metadata.json`\nfile if `\"skipMetadataEmit\"` is `false` . This option is `false` by default. This should only be used when `\"skipMetadataEmit\"` is `false` and `\"skipTemplateCodegen\"` is `true`.", - "translation": "这个选项告诉模板编译器如果 `\"skipMetadataEmit\"` 为 `false`,那就把错误信息汇报到 `.metadata.json` 中。\n只有当 `\"skipMetadataEmit\"` 为 `false` 且 `\"skipTemplateCodegen\"` 为 `true` 时才应该使用这个选项。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ITISINTENDEDTOVALIDATETHEMETADATAJSONFILESEMITTEDFORBUNDLINGWITHANNPMPACKAGETHEVALIDATIONISOVERLYSTRICTANDCANEMITERRORSFORMETADATATHATWOULDNEVERPRODUCEANERRORWHENUSEDBYTHETEMPLATECOMPILERYOUCANCHOOSETOSUPPRESSTHEERROREMITTEDBYTHISOPTIONFORANEXPORTEDSYMBOLBYINCLUDINGDYNAMICINTHECOMMENTDOCUMENTINGTHESYMBOL", - "original": "It is intended to validate the `.metadata.json` files emitted for bundling with an `npm` package. The validation is overly strict and can emit errors for metadata that would never produce an error when used by the template compiler. You can choose to suppress the error emitted by this option for an exported symbol by including `@dynamic` in the comment documenting the symbol.", - "translation": "它的设计意图是要验证为打包 `npm` 而生成的 `.metadata.json` 文件。\n这种验证过于严格,在使用模板编译器时甚至可能会对那些铁定不会出错的元数据文件报告一些错误。\n你可以用 `@dynamic` 在注释中指定一些要导出的符号,来禁止对它们报告错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ITISVALIDFORMETADATAJSONFILESTOCONTAINERRORSTHETEMPLATECOMPILERREPORTSTHESEERRORSIFTHEMETADATAISUSEDTODETERMINETHECONTENTSOFANANNOTATIONTHEMETADATACOLLECTORCANNOTPREDICTTHESYMBOLSTHATAREDESIGNEDTOUSEINANANNOTATIONSOITWILLPREEMPTIVELYINCLUDEERRORNODESINTHEMETADATAFORTHEEXPORTEDSYMBOLSTHETEMPLATECOMPILERCANTHENUSETHEERRORNODESTOREPORTANERRORIFTHESESYMBOLSAREUSEDIFTHECLIENTOFALIBRARYINTENDSTOUSEASYMBOLINANANNOTATIONTHETEMPLATECOMPILERWILLNOTNORMALLYREPORTTHISUNTILTHECLIENTUSESTHESYMBOLTHISOPTIONALLOWSDETECTINGTHESEERRORSDURINGTHEBUILDPHASEOFTHELIBRARYANDISUSEDFOREXAMPLEINPRODUCINGANGULARLIBRARIESTHEMSELVES", - "original": "It is valid for `.metadata.json` files to contain errors. The template compiler reports these errors\nif the metadata is used to determine the contents of an annotation. The metadata\ncollector cannot predict the symbols that are designed to use in an annotation, so it will preemptively\ninclude error nodes in the metadata for the exported symbols. The template compiler can then use the error\nnodes to report an error if these symbols are used. If the client of a library intends to use a symbol in an annotation, the template compiler will not normally report\nthis until the client uses the symbol. This option allows detecting these errors during the build phase of\nthe library and is used, for example, in producing Angular libraries themselves.", - "translation": "对于 `.metadata.json` 文件来说,包含错误是正常的。如果这些元数据被用来确定注解的内容,模板编译器就会报告这些错误。\n元数据收集器无法判断这些符号的设计目的是用在注解中,所以它将会自作主张,在元数据中为这些导出的符号添加错误节点。\n如果这些符号被用到了,模板编译器就会根据这些错误节点报告错误。\n如果某个库的使用者只是在注解中(而不是普通代码中)使用这些符号,模板编译器通常不会报错。\n这个选项允许在该库(比如 Angular 自身这些库)的构建和使用过程中检测这类错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONTELLSTHECOMPILERTOSUPPRESSEMITTINGNGFACTORYJSANDNGSTYLEJSFILESWHENSETTHISTURNSOFFMOSTOFTHETEMPLATECOMPILERANDDISABLESREPORTINGTEMPLATEDIAGNOSTICSTHISOPTIONCANBEUSEDTOINSTRUCTTHETEMPLATECOMPILERTOPRODUCEMETADATAJSONFILESFORDISTRIBUTIONWITHANNPMPACKAGEWHILEAVOIDINGTHEPRODUCTIONOFNGFACTORYJSANDNGSTYLEJSFILESTHATCANNOTBEDISTRIBUTEDTONPM", - "original": "This option tells the compiler to suppress emitting `.ngfactory.js` and `.ngstyle.js` files. When set,\nthis turns off most of the template compiler and disables reporting template diagnostics.\nThis option can be used to instruct the\ntemplate compiler to produce `.metadata.json` files for distribution with an `npm` package while\navoiding the production of `.ngfactory.js` and `.ngstyle.js` files that cannot be distributed to\n`npm`.", - "translation": "这个选项告诉编译器忽略从 `.ngfactory.js` 和 `.ngstyle.js` 文件中发出的错误。\n如果为 `true`,它就会关闭大多数的模板编译器,并禁止汇报模板诊断信息。\n这个选项用于指示模板编译器为通过 `npm` 包分发而生成 `.metadata.json` 文件,同时避免生成无法分发到 `npm` 的 `.ngfactory.js` 和 `.ngstyle.js` 文件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "WHENSETTOTRUETHISOPTIONSTELLSTHECOMPILERTOREPORTANERRORFORAPARAMETERSUPPLIEDWHOSEINJECTIONTYPECANNOTBEDETERMINEDWHENTHISVALUEOPTIONISNOTPROVIDEDORISFALSECONSTRUCTORPARAMETERSOFCLASSESMARKEDWITHINJECTABLEWHOSETYPECANNOTBERESOLVEDWILLPRODUCEAWARNING", - "original": "When set to `true`, this options tells the compiler to report an error for a parameter supplied\nwhose injection type cannot be determined. When this value option is not provided or is `false`, constructor parameters of classes marked with `@Injectable` whose type cannot be resolved will\nproduce a warning.", - "translation": "当设置为 `true` 时,该选项会告诉编译器为那些无法确定其类型的注入参数报告错误。\n当该值没有提供或未 `false` 时,那些带有 `@Injectable` 的类,如果其构造参数的类型无法解析,就会生成一个警告。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "NOTE:ITISRECOMMENDEDTOCHANGETHISOPTIONEXPLICITLYTOTRUEASTHISOPTIONWILLDEFAULTTOTRUEINTHEFUTURE", - "original": "*Note*: It is recommended to change this option explicitly to `true` as this option will default to `true` in the future.", - "translation": "*注意*:建议把该选项显式改为 `true`,因为将来这个选项的默认值会是 `true`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "WHENSETTOTRUETHISOPTIONTELLSTHETEMPLATECOMPILERTOGENERATEAFLATMODULEINDEXOFTHEGIVENFILENAMEANDTHECORRESPONDINGFLATMODULEMETADATAUSETHISOPTIONWHENCREATINGFLATMODULESTHATAREPACKAGEDSIMILARLYTOANGULARCOREANDANGULARCOMMONWHENTHISOPTIONISUSEDTHEPACKAGEJSONFORTHELIBRARYSHOULDREFERTOTHEGENERATEDFLATMODULEINDEXINSTEADOFTHELIBRARYINDEXFILEWITHTHISOPTIONONLYONEMETADATAJSONFILEISPRODUCEDTHATCONTAINSALLTHEMETADATANECESSARYFORSYMBOLSEXPORTEDFROMTHELIBRARYINDEXINTHEGENERATEDNGFACTORYJSFILESTHEFLATMODULEINDEXISUSEDTOIMPORTSYMBOLSTHATINCLUDESBOTHTHEPUBLICAPIFROMTHELIBRARYINDEXASWELLASSHROWDEDINTERNALSYMBOLS", - "original": "When set to `true`, this option tells the template compiler to generate a flat module\nindex of the given file name and the corresponding flat module metadata. Use this option when creating\nflat modules that are packaged similarly to `@angular/core` and `@angular/common`. When this option\nis used, the `package.json` for the library should refer\nto the generated flat module index instead of the library index file. With this\noption only one `.metadata.json` file is produced that contains all the metadata necessary\nfor symbols exported from the library index. In the generated `.ngfactory.js` files, the flat\nmodule index is used to import symbols that includes both the public API from the library index\nas well as shrowded internal symbols.", - "translation": "当为 `true` 时,该选项告诉模板编译器生成一个指定名字的扁平模块索引和相应的扁平模块元数据。\n当要创建像 `@angular/core` 和 `@angular/common` 这样的扁平模块包时,请使用本选项。\n当使用本选项时,库的 `package.json` 文件就会引用生成的扁平模块索引,而不是库的索引文件。\n当使用本选项时,只会生成一个 `.metadata.json` 文件,其中包含从库索引中导出的符号所需的全部元数据。\n在生成的 `.ngfactory.js` 文件中,扁平模块索会用来导入包括库的公共 API 和隐藏的内部符号在内的全部符号。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "BYDEFAULTTHETSFILESUPPLIEDINTHEFILESFIELDISASSUMEDTOBELIBRARYINDEXIFMORETHANONETSFILEISSPECIFIEDLIBRARYINDEXISUSEDTOSELECTTHEFILETOUSEIFMORETHANONETSFILEISSUPPLIEDWITHOUTALIBRARYINDEXANERRORISPRODUCEDAFLATMODULEINDEXDTSANDJSWILLBECREATEDWITHTHEGIVENFLATMODULEOUTFILENAMEINTHESAMELOCATIONASTHELIBRARYINDEXDTSFILEFOREXAMPLEIFALIBRARYUSESPUBLICAPITSFILEASTHELIBRARYINDEXOFTHEMODULETHETSCONFIGJSONFILESFIELDWOULDBEPUBLICAPITSTHEFLATMODULEOUTFILEOPTIONSCOULDTHENBESETTOFOREXAMPLEINDEXJSWHICHPRODUCESINDEXDTSANDINDEXMETADATAJSONFILESTHELIBRARYSPACKAGEJSONSMODULEFIELDWOULDBEINDEXJSANDTHETYPINGSFIELDWOULDBEINDEXDTS", - "original": "By default the `.ts` file supplied in the `files` field is assumed to be library index.\nIf more than one `.ts` file is specified, `libraryIndex` is used to select the file to use.\nIf more than one `.ts` file is supplied without a `libraryIndex`, an error is produced. A flat module\nindex `.d.ts` and `.js` will be created with the given `flatModuleOutFile` name in the same\nlocation as the library index `.d.ts` file. For example, if a library uses\n`public_api.ts` file as the library index of the module, the `tsconfig.json` `files` field\nwould be `[\"public_api.ts\"]`. The `flatModuleOutFile` options could then be set to, for\nexample `\"index.js\"`, which produces `index.d.ts` and `index.metadata.json` files. The\nlibrary's `package.json`'s `module` field would be `\"index.js\"` and the `typings` field\nwould be `\"index.d.ts\"`.", - "translation": "默认情况下,`files` 字段中提供的 `.ts` 文件会被当做库索引。\n如果指定了多个 `.ts` 文件,就要用 `libraryIndex` 来选择要作为库索引的文件。\n扁平模块索引会用 `flatModuleOutFile` 中给出的名字创建 `.d.ts` 和 `.js` 文件,并放在和库索引的 `.d.ts` 文件相同的位置。\n比如,如果某个库使用 `public_api.ts` 文件作为该模块的库索引,那么 `tsconfig.json` 的 `files` 字段就应该是 `[\"public_api.ts\"]`。\n然后可以把 `flatModuleOutFile` 选项设置为 `\"index.js\"`,它就会生成 `index.d.ts` 和 `index.metadata.json` 文件。\n该库的 `package.json` 文件的 `module` 字段将会是 `\"index.js\"`,而 `typings` 字段会是 `\"index.d.ts\"`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONSPECIFIESTHEPREFERREDMODULEIDTOUSEFORIMPORTINGAFLATMODULEREFERENCESGENERATEDBYTHETEMPLATECOMPILERWILLUSETHISMODULENAMEWHENIMPORTINGSYMBOLSFROMTHEFLATMODULETHISISONLYMEANINGFULWHENFLATMODULEOUTFILEISALSOSUPPLIEDOTHERWISETHECOMPILERIGNORESTHISOPTION", - "original": "This option specifies the preferred module id to use for importing a flat module.\nReferences generated by the template compiler will use this module name when importing symbols\nfrom the flat module.\nThis is only meaningful when `flatModuleOutFile` is also supplied. Otherwise the compiler ignores\nthis option.", - "translation": "该选项指定建议的模块 ID,这个 ID 用于导入扁平模块。\n从扁平模块中导入符号时,由模板编译器生成的引用将使用这个模块名称。\n它仅在同时提供了 `flatModuleOutFile` 选项时才有意义,否则,编译器将忽略此选项。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONTELLSTHETEMPLATECOMPILERTOGENERATEFACTORYFILESNGFACTORYJSANDNGSTYLEJSFORDTSFILESWITHACORRESPONDINGMETADATAJSONFILETHISOPTIONDEFAULTSTOTRUEWHENTHISOPTIONISFALSEFACTORYFILESAREGENERATEDONLYFORTSFILES", - "original": "This option tells the template compiler to generate factory files (`.ngfactory.js` and `.ngstyle.js`)\nfor `.d.ts` files with a corresponding `.metadata.json` file. This option defaults to\n`true`. When this option is `false`, factory files are generated only for `.ts` files.", - "translation": "这个选项告诉模板编译器也为与 `.metadata.json` 文件对应的 `.d.ts` 文件生成工厂文件(`.ngfactory.js` 和 `.ngstyle.js`)。\n这个选项默认为 `true`。当该选项为 `false` 时,只会为 `.ts` 文件生成工厂文件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONSHOULDBESETTOFALSEWHENUSINGFACTORYSUMMARIES", - "original": "This option should be set to `false` when using factory summaries.", - "translation": "当使用工厂汇总器时,这个选项应该设置为 `false`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONTELLSTHECOMPILERTOENABLETHEBINDINGEXPRESSIONVALIDATION#BINDINGEXPRESSIONVALIDATIONPHASEOFTHETEMPLATECOMPILERWHICHUSESTYPESCRIPTTOVALIDATEBINDINGEXPRESSIONS", - "original": "This option tells the compiler to enable the [binding expression validation](#binding-expression-validation)\nphase of the template compiler which uses TypeScript to validate binding expressions.", - "translation": "该选项告诉编译器要为模板编译器启用[绑定表达式验证](#binding-expression-validation)阶段,它会使用 TypeScript 来验证绑定表达式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONISFALSEBYDEFAULT", - "original": "This option is `false` by default.", - "translation": "该选项默认是 `false`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "NOTE:ITISRECOMMENDEDTOSETTHISTOTRUEASTHISOPTIONWILLDEFAULTTOTRUEINTHEFUTURE", - "original": "*Note*: It is recommended to set this to `true` as this option will default to `true` in the future.", - "translation": "*注意*:建议把它设置为 `true`,因为将来它会默认为 `true`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONTELLSTHECOMPILERTOUSETSICKLEHTTPS:GITHUBCOMANGULARTSICKLETOANNOTATETHEEMITTEDJAVASCRIPTWITHJSDOCHTTP:USEJSDOCORGCOMMENTSNEEDEDBYTHECLOSURECOMPILERHTTPS:GITHUBCOMGOOGLECLOSURECOMPILERTHISOPTIONDEFAULTSTOFALSE", - "original": "This option tells the compiler to use [Tsickle](https://github.com/angular/tsickle) to annotate the emitted\nJavaScript with [JsDoc](http://usejsdoc.org/) comments needed by the\n[Closure Compiler](https://github.com/google/closure-compiler). This option defaults to `false`.", - "translation": "该选项告诉编译器使用 [Tsickle](https://github.com/angular/tsickle) 来为生成的 JavaScript 添加供 [Closure Compiler](https://github.com/google/closure-compiler) 使用的 [JsDoc](http://usejsdoc.org/) 注解。\n该选项默认为 `false`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "USETHISOPTIONTOMODIFYHOWTHEANGULARSPECIFICANNOTATIONSAREEMITTEDTOIMPROVETREESHAKINGNONANGULARANNOTATIONSANDDECORATORSAREUNAFFECTEDDEFAULTISSTATICFIELDS", - "original": "Use this option to modify how the Angular specific annotations are emitted to improve tree-shaking. Non-Angular\nannotations and decorators are unaffected. Default is `static fields`.", - "translation": "使用这个选项来修改生成 Angular 特有注解的方式,以提升摇树优化(tree-shaking)的效果。它对 Angular 自身之外的注解和装饰器无效。\n默认值是 `static fields`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "VALUEDESCRIPTIONDECORATORSLEAVETHEDECORATORSINPLACETHISMAKESCOMPILATIONFASTERTYPESCRIPTWILLEMITCALLSTOTHEDECORATEHELPERUSEEMITDECORATORMETADATAFORRUNTIMEREFLECTIONHOWEVERTHERESULTINGCODEWILLNOTPROPERLYTREESHAKESTATICFIELDSREPLACEDECORATORSWITHASTATICFIELDINTHECLASSALLOWSADVANCEDTREESHAKERSLIKECLOSURECOMPILERHTTPS:GITHUBCOMGOOGLECLOSURECOMPILERTOREMOVEUNUSEDCLASSES", - "original": "value | description\n----------------|-------------------------------------------------------------\n`decorators` | Leave the Decorators in-place. This makes compilation faster. TypeScript will emit calls to the `__decorate` helper. Use `--emitDecoratorMetadata` for runtime reflection. However, the resulting code will not properly tree-shake.\n`static fields` | Replace decorators with a static field in the class. Allows advanced tree-shakers like [Closure Compiler](https://github.com/google/closure-compiler) to remove unused classes.", - "translation": "value | description说明\n----------------|-------------------------------------------------------------\n`decorators` | Leave the Decorators in-place. This makes compilation faster. TypeScript will emit calls to the `__decorate` helper. Use `--emitDecoratorMetadata` for runtime reflection. However, the resulting code will not properly tree-shake. 原地保留装饰器。这会让编译过程更快。TypeScript 将会生成对 `__decorate` 助手函数的调用。使用 `--emitDecoratorMetadata` 进行运行时反射。不过,生成的代码将无法正常进行摇树优化。\n`static fields` | Replace decorators with a static field in the class. Allows advanced tree-shakers like [Closure Compiler](https://github.com/google/closure-compiler) to remove unused classes.使用类的静态字段代替装饰器。它允许像 [Closure Compiler](https://github.com/google/closure-compiler) 这样的高级摇树优化器移除未使用的类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISTELLSTHECOMPILERTOPRINTEXTRAINFORMATIONWHILECOMPILINGTEMPLATES", - "original": "This tells the compiler to print extra information while compiling templates.", - "translation": "它告诉编译器在编译模板时打印额外的信息。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEANGULARTEMPLATECOMPILERTRANSFORMSCODETHATISUSEDORCOULDBEUSEDINANANNOTATIONTOALLOWITTOBEIMPORTEDFROMTEMPLATEFACTORYMODULESSEEMETADATAREWRITING#METADATAREWRITINGFORMOREINFORMATION", - "original": "The Angular template compiler transforms code that is used, or could be used, in an annotation\nto allow it to be imported from template factory modules. See\n[metadata rewriting](#metadata-rewriting) for more information.", - "translation": "Angular 的模板编译器会转换注解中使用或可能使用的代码,以便能从模板的工厂模块中导入它。\n参见[元数据重写](#metadata-rewriting)以了解更多信息。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "SETTINGTHISOPTIONTOFALSEDISABLESTHISREWRITINGREQUIRINGTHEREWRITINGTOBEDONEMANUALLY", - "original": "Setting this option to `false` disables this rewriting, requiring the rewriting to be\ndone manually.", - "translation": "把该选项设置为 `false` 将会禁止这种重写,如果需要重写就去得人工完成了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISOPTIONTELLSTHECOMPILERWHETHERTOREMOVEBLANKTEXTNODESFROMCOMPILEDTEMPLATESASOFV6THISOPTIONISFALSEBYDEFAULTWHICHRESULTSINSMALLEREMITTEDTEMPLATEFACTORYMODULES", - "original": "This option tells the compiler whether to remove blank text nodes from compiled templates.\nAs of v6, this option is `false` by default, which results in smaller emitted template factory modules.", - "translation": "该选项会告诉编译器是否要从编译后的模板中移除空白的文本节点。\n对于 Angular v6,该选项默认为 `false`,它会移除空白节点,以生成更小的模板工厂模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "TELLSTHECOMPILERTOGENERATEALLTHEPOSSIBLEGENERATEDFILESEVENIFTHEYAREEMPTYTHISOPTIONISFALSEBYDEFAULTTHISISANOPTIONUSEDBYBAZELBUILDRULESANDISNEEDEDTOSIMPLIFYHOWBAZELRULESTRACKFILEDEPENDENCIESITISNOTRECOMMENDEDTOUSETHISOPTIONOUTSIDEOFTHEBAZELRULES", - "original": "Tells the compiler to generate all the possible generated files even if they are empty. This option is\n`false` by default. This is an option used by `bazel` build rules and is needed to simplify\nhow `bazel` rules track file dependencies. It is not recommended to use this option outside of the `bazel`\nrules.", - "translation": "告诉编译器生成所有可能生成的文件 —— 即使是空文件。\n该选项默认为 `false`。\n这是供 `bazel` 构建规则使用的选项,它用于简化 `bazel` 规则跟踪文件依赖的方式。\n除了 `bazel` 规则之外不建议使用该选项。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "TELLSTHECOMPILERTOGENERATEDEFINITIONSUSINGTHERENDER3STYLECODEGENERATIONTHISOPTIONDEFAULTSTOFALSE", - "original": "Tells the compiler to generate definitions using the Render3 style code generation. This option defaults to `false`.", - "translation": "告诉编译器使用 Render3 风格的代码生成器来来生成各种定义。\n该选项默认为 `false`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "NOTALLFEATURESARESUPPORTEDWITHTHISOPTIONENABLEDITISONLYSUPPORTEDFOREXPERIMENTATIONANDTESTINGOFRENDER3STYLECODEGENERATION", - "original": "Not all features are supported with this option enabled. It is only supported\n for experimentation and testing of Render3 style code generation.", - "translation": "当开启该选项时,有些特性不受支持。它仅仅用来为试验和测试 Render3 风格的代码生成提供支持。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "NOTE:ISITNOTRECOMMENDEDTOUSETHISOPTIONASITISNOTYETFEATURECOMPLETEWITHTHERENDER2CODEGENERATION", - "original": "*Note*: Is it not recommended to use this option as it is not yet feature complete with the Render2 code generation.", - "translation": "*注意*:不建议使用该选项,因为它在使用 Render2 的代码生成器时还缺少一些特性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##ANGULARMETADATAANDAOT", - "original": "## Angular Metadata and AOT", - "translation": "## Angular 元数据与 AOT", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEANGULARAOTCOMPILEREXTRACTSANDINTERPRETSMETADATAABOUTTHEPARTSOFTHEAPPLICATIONTHATANGULARISSUPPOSEDTOMANAGE", - "original": "The Angular **AOT compiler** extracts and interprets **metadata** about the parts of the application that Angular is supposed to manage.", - "translation": "Angular 的 **AOT 编译器**会提取并解释应用中由 Angular 管理的各个部件的**元数据**。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ANGULARMETADATATELLSANGULARHOWTOCONSTRUCTINSTANCESOFYOURAPPLICATIONCLASSESANDINTERACTWITHTHEMATRUNTIME", - "original": "Angular metadata tells Angular how to construct instances of your application classes and interact with them at runtime.", - "translation": "Angular 的元数据会告诉 Angular 如何创建应用中类的实例以及如何在运行期间与它们交互。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUSPECIFYTHEMETADATAWITHDECORATORSSUCHASCOMPONENTANDINPUTYOUALSOSPECIFYMETADATAIMPLICITLYINTHECONSTRUCTORDECLARATIONSOFTHESEDECORATEDCLASSES", - "original": "You specify the metadata with **decorators** such as `@Component()` and `@Input()`.\nYou also specify metadata implicitly in the constructor declarations of these decorated classes.", - "translation": "你通过**装饰器**来指定元数据,比如 `@Component()` 和 `@Input()`。\n你还可以在这些带装饰器的类的构造函数中隐式指定元数据。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "INTHEFOLLOWINGEXAMPLETHECOMPONENTMETADATAOBJECTANDTHECLASSCONSTRUCTORTELLANGULARHOWTOCREATEANDDISPLAYANINSTANCEOFTYPICALCOMPONENT", - "original": "In the following example, the `@Component()` metadata object and the class constructor tell Angular how to create and display an instance of `TypicalComponent`.", - "translation": "在下列范例中,`@Component()` 元数据对象和类的构造函数会告诉 Angular 如何创建和显示 `TypicalComponent` 的实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEANGULARCOMPILEREXTRACTSTHEMETADATAONCEANDGENERATESAFACTORYFORTYPICALCOMPONENTWHENITNEEDSTOCREATEATYPICALCOMPONENTINSTANCEANGULARCALLSTHEFACTORYWHICHPRODUCESANEWVISUALELEMENTBOUNDTOANEWINSTANCEOFTHECOMPONENTCLASSWITHITSINJECTEDDEPENDENCY", - "original": "The Angular compiler extracts the metadata _once_ and generates a _factory_ for `TypicalComponent`.\nWhen it needs to create a `TypicalComponent` instance, Angular calls the factory, which produces a new visual element, bound to a new instance of the component class with its injected dependency.", - "translation": "Angular 编译器只提取**一次**元数据,并且为 `TypicalComponent` 生成一个**工厂**。\n当它需要创建 `TypicalComponent` 的实例时,Angular 调用这个工厂,工厂会生成一个新的可视元素,并且把它(及其依赖)绑定到组件类的一个新实例上。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##METADATARESTRICTIONS", - "original": "## Metadata restrictions", - "translation": "## 元数据的限制", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUWRITEMETADATAINASUBSETOFTYPESCRIPTTHATMUSTCONFORMTOTHEFOLLOWINGGENERALCONSTRAINTS:", - "original": "You write metadata in a _subset_ of TypeScript that must conform to the following general constraints:", - "translation": "你只能使用 TypeScript 的一个**子集**书写元数据,它必须满足下列限制:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "1LIMITEXPRESSIONSYNTAX#EXPRESSIONSYNTAXTOTHESUPPORTEDSUBSETOFJAVASCRIPT", - "original": "1. Limit [expression syntax](#expression-syntax) to the supported subset of JavaScript.", - "translation": "[表达式语法](#expression-syntax)只支持 JavaScript 的一个有限的子集。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "2ONLYREFERENCEEXPORTEDSYMBOLSAFTERCODEFOLDING#FOLDING", - "original": "2. Only reference exported symbols after [code folding](#folding).", - "translation": "只能引用[代码收缩](#folding)后导出的符号。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "3ONLYCALLFUNCTIONSSUPPORTED#SUPPORTEDFUNCTIONSBYTHECOMPILER", - "original": "3. Only call [functions supported](#supported-functions) by the compiler.", - "translation": "只能调用编译器[支持的那些函数](#supported-functions)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "4DECORATEDANDDATABOUNDCLASSMEMBERSMUSTBEPUBLIC", - "original": "4. Decorated and data-bound class members must be public.", - "translation": "被装饰和用于数据绑定的类成员必须是公共(public)的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THENEXTSECTIONSELABORATEONTHESEPOINTS", - "original": "The next sections elaborate on these points.", - "translation": "下一节将会详细解释这些问题。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##HOWAOTWORKS", - "original": "## How AOT works", - "translation": "## AOT 工作原理", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ITHELPSTOTHINKOFTHEAOTCOMPILERASHAVINGTWOPHASES:ACODEANALYSISPHASEINWHICHITSIMPLYRECORDSAREPRESENTATIONOFTHESOURCEANDACODEGENERATIONPHASEINWHICHTHECOMPILERSSTATICREFLECTORHANDLESTHEINTERPRETATIONASWELLASPLACESRESTRICTIONSONWHATITINTERPRETS", - "original": "It helps to think of the AOT compiler as having two phases: a code analysis phase in which it simply records a representation of the source; and a code generation phase in which the compiler's `StaticReflector` handles the interpretation as well as places restrictions on what it interprets.", - "translation": "可以把 AOT 编译器看做两个阶段:在代码分析阶段,它只记录源代码,而在代码生成阶段,编译器的 `StaticReflector` 会解释这些结果,并为这些结果加上限制。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##PHASE1:ANALYSIS", - "original": "## Phase 1: analysis", - "translation": "## 阶段 1:分析", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THETYPESCRIPTCOMPILERDOESSOMEOFTHEANALYTICWORKOFTHEFIRSTPHASEITEMITSTHEDTSTYPEDEFINITIONFILESWITHTYPEINFORMATIONTHATTHEAOTCOMPILERNEEDSTOGENERATEAPPLICATIONCODE", - "original": "The TypeScript compiler does some of the analytic work of the first phase. It emits the `.d.ts` _type definition files_ with type information that the AOT compiler needs to generate application code.", - "translation": "TypeScript 编译器会做一些初步的分析工作,它会生成**类型定义文件**`.d.ts`,其中带有类型信息,Angular 编译器需要借助它们来生成代码。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ATTHESAMETIMETHEAOTCOLLECTORANALYZESTHEMETADATARECORDEDINTHEANGULARDECORATORSANDOUTPUTSMETADATAINFORMATIONINMETADATAJSONFILESONEPERDTSFILE", - "original": "At the same time, the AOT **_collector_** analyzes the metadata recorded in the Angular decorators and outputs metadata information in **`.metadata.json`** files, one per `.d.ts` file.", - "translation": "同时,AOT **收集器(collector)** 会记录 Angular 装饰器中的元数据,并把它们输出到**`.metadata.json`**文件中,和每个 `.d.ts` 文件相对应。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUCANTHINKOFMETADATAJSONASADIAGRAMOFTHEOVERALLSTRUCTUREOFADECORATORSMETADATAREPRESENTEDASANABSTRACTSYNTAXTREEASTHTTPS:ENWIKIPEDIAORGWIKIABSTRACTSYNTAXTREE", - "original": "You can think of `.metadata.json` as a diagram of the overall structure of a decorator's metadata, represented as an [abstract syntax tree (AST)](https://en.wikipedia.org/wiki/Abstract_syntax_tree).", - "translation": "你可以把 `.metadata.json` 文件看做一个包括全部装饰器的元数据的全景图,就像[抽象语法树 (AST) ](https://en.wikipedia.org/wiki/Abstract_syntax_tree)一样。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ANGULARSSCHEMATSHTTPS:GITHUBCOMANGULARANGULARBLOBMASTERPACKAGESCOMPILERCLISRCMETADATASCHEMATSDESCRIBESTHEJSONFORMATASACOLLECTIONOFTYPESCRIPTINTERFACES", - "original": "Angular's [schema.ts](https://github.com/angular/angular/blob/master/packages/compiler-cli/src/metadata/schema.ts)\ndescribes the JSON format as a collection of TypeScript interfaces.", - "translation": "Angular 的 [schema.ts](https://github.com/angular/angular/blob/master/packages/compiler-cli/src/metadata/schema.ts) 把这个 JSON 格式表示成了一组 TypeScript 接口。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###EXPRESSIONSYNTAX", - "original": "### Expression syntax", - "translation": "### 表达式语法", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOLLECTORONLYUNDERSTANDSASUBSETOFJAVASCRIPTDEFINEMETADATAOBJECTSWITHTHEFOLLOWINGLIMITEDSYNTAX:", - "original": "The _collector_ only understands a subset of JavaScript.\nDefine metadata objects with the following limited syntax:", - "translation": "这个**收集器**只能理解 JavaScript 的一个子集。\n请使用下列受限语法定义元数据对象:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "SYNTAXEXAMPLELITERALOBJECTCHERRY:TRUEAPPLE:TRUEMINCEMEAT:FALSELITERALARRAYCHERRIESFLOURSUGARSPREADINLITERALARRAYAPPLESFLOURTHERESTCALLSBAKEINGREDIENTSNEWNEWOVENPROPERTYACCESSPIESLICEARRAYINDEXINGREDIENTS0IDENTIFIERREFERENCECOMPONENTATEMPLATESTRINGCODE#96PIEISMULTIPLIERTIMESBETTERTHANCAKE#96CODELITERALSTRINGPILITERALNUMBER314153265LITERALBOOLEANTRUELITERALNULLNULLSUPPORTEDPREFIXOPERATORCAKESUPPORTEDBINARYOPERATORABCONDITIONALOPERATORAB:CPARENTHESESAB", - "original": "Syntax | Example\n----------------------------------- | -----------------------------------\nLiteral object | `{cherry: true, apple: true, mincemeat: false}`\nLiteral array | `['cherries', 'flour', 'sugar']`\nSpread in literal array | `['apples', 'flour', ...the_rest]`\nCalls | `bake(ingredients)`\nNew | `new Oven()`\nProperty access | `pie.slice`\nArray index | `ingredients[0]`\nIdentifier reference | `Component`\nA template string | `pie is ${multiplier} times better than cake`\nLiteral string | `'pi'`\nLiteral number | `3.14153265`\nLiteral boolean | `true`\nLiteral null | `null`\nSupported prefix operator | `!cake`\nSupported Binary operator | `a + b`\nConditional operator | `a ? b : c`\nParentheses | `(a + b)`", - "translation": "Syntax语法 | Example范例\n----------------------------------- | -----------------------------------\nLiteral object对象字面量 | `{cherry: true, apple: true, mincemeat: false}`\nLiteral array数组字面量 | `['cherries', 'flour', 'sugar']`\nSpread in literal array字面量数组展开 | `['apples', 'flour', ...the_rest]`\nCalls调用 | `bake(ingredients)`\nNew创建对象 | `new Oven()`\nProperty access属性访问 | `pie.slice`\nArray index数组索引 | `ingredients[0]`\nIdentifier reference标识符引用 | `Component`\nA template string模板字符串 | `pie is ${multiplier} times better than cake`\nLiteral string字符串字面量 | `'pi'`\nLiteral number数字字面量 | `3.14153265`\nLiteral boolean逻辑字面量 | `true`\nLiteral null空字面量 | `null`\nSupported prefix operator受支持的前缀操作符 | `!cake`\nSupported Binary operator受支持的二元操作符 | `a + b`\nConditional operator条件操作符 | `a ? b : c`\nParentheses括号 | `(a + b)`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "IFANEXPRESSIONUSESUNSUPPORTEDSYNTAXTHECOLLECTORWRITESANERRORNODETOTHEMETADATAJSONFILETHECOMPILERLATERREPORTSTHEERRORIFITNEEDSTHATPIECEOFMETADATATOGENERATETHEAPPLICATIONCODE", - "original": "If an expression uses unsupported syntax, the _collector_ writes an error node to the `.metadata.json` file. The compiler later reports the error if it needs that\npiece of metadata to generate the application code.", - "translation": "如果表达式使用了不支持的语法,**收集器**就会往 `.metadata.json` 文件中写入一个错误节点。稍后,如果编译器用到元数据中的这部分内容来生成应用代码,它就会报告这个错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "IFYOUWANTNGCTOREPORTSYNTAXERRORSIMMEDIATELYRATHERTHANPRODUCEAMETADATAJSONFILEWITHERRORSSETTHESTRICTMETADATAEMITOPTIONINTSCONFIG", - "original": "If you want `ngc` to report syntax errors immediately rather than produce a `.metadata.json` file with errors, set the `strictMetadataEmit` option in `tsconfig`.", - "translation": "如果你希望 `ngc` 立即汇报这些语法错误,而不要生成带有错误信息的 `.metadata.json` 文件,可以到 `tsconfig` 中设置 `strictMetadataEmit` 选项。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ANGULARLIBRARIESHAVETHISOPTIONTOENSURETHATALLANGULARMETADATAJSONFILESARECLEANANDITISABESTPRACTICETODOTHESAMEWHENBUILDINGYOUROWNLIBRARIES", - "original": "Angular libraries have this option to ensure that all Angular `.metadata.json` files are clean and it is a best practice to do the same when building your own libraries.", - "translation": "Angular 库通过这个选项来确保所有的 `.metadata.json` 文件都是干净的。当你要构建自己的代码库时,这也同样是一项最佳实践。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###NOARROWFUNCTIONS", - "original": "### No arrow functions", - "translation": "### 不要有箭头函数", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEAOTCOMPILERDOESNOTSUPPORTFUNCTIONEXPRESSIONSHTTPS:DEVELOPERMOZILLAORGENUSDOCSWEBJAVASCRIPTREFERENCEOPERATORSFUNCTIONANDARROWFUNCTIONSHTTPS:DEVELOPERMOZILLAORGENUSDOCSWEBJAVASCRIPTREFERENCEFUNCTIONSARROWFUNCTIONSALSOCALLEDLAMBDAFUNCTIONS", - "original": "The AOT compiler does not support [function expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function)\nand [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions), also called _lambda_ functions.", - "translation": "AOT 编译器不支持 [函数表达式](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function)\n和 [箭头函数](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)(也叫 *Lambda* 函数)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "CONSIDERTHEFOLLOWINGCOMPONENTDECORATOR:", - "original": "Consider the following component decorator:", - "translation": "考虑如下组件装饰器:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEAOTCOLLECTORDOESNOTSUPPORTTHEARROWFUNCTIONNEWSERVERINAMETADATAEXPRESSIONITGENERATESANERRORNODEINPLACEOFTHEFUNCTION", - "original": "The AOT _collector_ does not support the arrow function, `() => new Server()`, in a metadata expression.\nIt generates an error node in place of the function.", - "translation": "AOT 的*收集器*不支持在元数据表达式中出现箭头函数 `() => new Server()`。\n它会在该函数中就地生成一个错误节点。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "WHENTHECOMPILERLATERINTERPRETSTHISNODEITREPORTSANERRORTHATINVITESYOUTOTURNTHEARROWFUNCTIONINTOANEXPORTEDFUNCTION", - "original": "When the compiler later interprets this node, it reports an error that invites you to turn the arrow function into an _exported function_.", - "translation": "稍后,当编译器解释该节点时,它就会报告一个错误,让你把这个箭头函数转换成一个*导出的函数*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUCANFIXTHEERRORBYCONVERTINGTOTHIS:", - "original": "You can fix the error by converting to this:", - "translation": "你可以把它改写成这样来修复这个错误:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "BEGINNINGINVERSION5THECOMPILERAUTOMATICALLYPERFORMSTHISREWRITINGWHILEEMITTINGTHEJSFILE", - "original": "Beginning in version 5, the compiler automatically performs this rewriting while emitting the `.js` file.", - "translation": "从 Angular v5 开始,编译器会在生成 `.js` 文件时自动执行这种改写。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###LIMITEDFUNCTIONCALLS", - "original": "### Limited function calls", - "translation": "### 受限函数调用", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOLLECTORCANREPRESENTAFUNCTIONCALLOROBJECTCREATIONWITHNEWASLONGASTHESYNTAXISVALIDTHECOLLECTORONLYCARESABOUTPROPERSYNTAX", - "original": "The _collector_ can represent a function call or object creation with `new` as long as the syntax is valid. The _collector_ only cares about proper syntax.", - "translation": "只要语法有效,*收集器*就可以支持函数调用或使用 `new` 来创建对象。*收集器*只在乎语法是否正确。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "BUTBEWARETHECOMPILERMAYLATERREFUSETOGENERATEACALLTOAPARTICULARFUNCTIONORCREATIONOFAPARTICULAROBJECTTHECOMPILERONLYSUPPORTSCALLSTOASMALLSETOFFUNCTIONSANDWILLUSENEWFORONLYAFEWDESIGNATEDCLASSESTHESEFUNCTIONSANDCLASSESAREINATABLEOFBELOW#SUPPORTEDFUNCTIONS", - "original": "But beware. The compiler may later refuse to generate a call to a _particular_ function or creation of a _particular_ object.\nThe compiler only supports calls to a small set of functions and will use `new` for only a few designated classes. These functions and classes are in a table of [below](#supported-functions).", - "translation": "但要注意。编译器稍后可能拒绝调用*特定的*函数或拒绝创建*特定的*对象。\n编译器值仅支持调用一小部分函数,也只能 `new` 一小部分类。这些函数和类列在了[后面](#supported-functions)的表格中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###FOLDING", - "original": "### Folding", - "translation": "### 折叠(fold)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERCANONLYRESOLVEREFERENCESTOEXPORTEDSYMBOLSFORTUNATELYTHECOLLECTORENABLESLIMITEDUSEOFNONEXPORTEDSYMBOLSTHROUGHFOLDING", - "original": "The compiler can only resolve references to **_exported_** symbols.\nFortunately, the _collector_ enables limited use of non-exported symbols through _folding_.", - "translation": "编译器只能解析对***导出***的符号的引用。\n幸运的是,*收集器*支持通过*折叠*来有限的使用那些未导出的符号。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOLLECTORMAYBEABLETOEVALUATEANEXPRESSIONDURINGCOLLECTIONANDRECORDTHERESULTINTHEMETADATAJSONINSTEADOFTHEORIGINALEXPRESSION", - "original": "The _collector_ may be able to evaluate an expression during collection and record the result in the `.metadata.json` instead of the original expression.", - "translation": "*收集器*可以在收集期间执行表达式,并用其结果代替原始表达式,记录到 `.metadata.json` 中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "FOREXAMPLETHECOLLECTORCANEVALUATETHEEXPRESSION1234ANDREPLACEITWITHTHERESULT10", - "original": "For example, the _collector_ can evaluate the expression `1 + 2 + 3 + 4` and replace it with the result, `10`.", - "translation": "比如,*收集器*可以执行表达式 `1 + 2 + 3 + 4`,并使用它的结果 `10` 替换它。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISPROCESSISCALLEDFOLDINGANEXPRESSIONTHATCANBEREDUCEDINTHISMANNERISFOLDABLE", - "original": "This process is called _folding_. An expression that can be reduced in this manner is _foldable_.", - "translation": "这个过程被称为*折叠*。能用这种方式进行简化的表达式就是*可折叠的*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOLLECTORCANEVALUATEREFERENCESTOMODULELOCALCONSTDECLARATIONSANDINITIALIZEDVARANDLETDECLARATIONSEFFECTIVELYREMOVINGTHEMFROMTHEMETADATAJSONFILE", - "original": "The collector can evaluate references to\nmodule-local `const` declarations and initialized `var` and `let` declarations, effectively removing them from the `.metadata.json` file.", - "translation": "收集器可以计算对模块局部变量的 `const` 声明和初始化过的 `var` 和 `let` 声明,并从 `.metadata.json` 文件中移除它们。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "CONSIDERTHEFOLLOWINGCOMPONENTDEFINITION:", - "original": "Consider the following component definition:", - "translation": "考虑下列组件定义:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERCOULDNOTREFERTOTHETEMPLATECONSTANTBECAUSEITISNTEXPORTED", - "original": "The compiler could not refer to the `template` constant because it isn't exported.", - "translation": "编译器不能引用 `template` 常量,因为它是未导出的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "BUTTHECOLLECTORCANFOLDTHETEMPLATECONSTANTINTOTHEMETADATADEFINITIONBYINLININGITSCONTENTSTHEEFFECTISTHESAMEASIFYOUHADWRITTEN:", - "original": "But the _collector_ can _fold_ the `template` constant into the metadata definition by inlining its contents.\nThe effect is the same as if you had written:", - "translation": "但是*折叠器*可以通过内联 `template` 常量的方式把它*折叠*进元数据定义中。\n最终的结果和你以前的写法是一样的:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEREISNOLONGERAREFERENCETOTEMPLATEANDTHEREFORENOTHINGTOTROUBLETHECOMPILERWHENITLATERINTERPRETSTHECOLLECTORSOUTPUTINMETADATAJSON", - "original": "There is no longer a reference to `template` and, therefore, nothing to trouble the compiler when it later interprets the _collector's_ output in `.metadata.json`.", - "translation": "这里没有对 `template` 的引用,因此,当编译器稍后对位于 `.metadata.json` 中的*收集器*输出进行解释时,不会再出问题。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUCANTAKETHISEXAMPLEASTEPFURTHERBYINCLUDINGTHETEMPLATECONSTANTINANOTHEREXPRESSION:", - "original": "You can take this example a step further by including the `template` constant in another expression:", - "translation": "你还可以通过把 `template` 常量包含在其它表达式中来让这个例子深入一点:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOLLECTORREDUCESTHISEXPRESSIONTOITSEQUIVALENTFOLDEDSTRING:", - "original": "The _collector_ reduces this expression to its equivalent _folded_ string:", - "translation": "*收集器*把该表达式缩减成其等价的*已折叠*字符串:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "####FOLDABLESYNTAX", - "original": "#### Foldable syntax", - "translation": "#### 可折叠的语法", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEFOLLOWINGTABLEDESCRIBESWHICHEXPRESSIONSTHECOLLECTORCANANDCANNOTFOLD:", - "original": "The following table describes which expressions the _collector_ can and cannot fold:", - "translation": "下表中描述了哪些表达式是否能被*收集器*折叠:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "SYNTAXFOLDABLELITERALOBJECTYESLITERALARRAYYESSPREADINLITERALARRAYNOCALLSNONEWNOPROPERTYACCESSYESIFTARGETISFOLDABLEARRAYINDEXYESIFTARGETANDINDEXAREFOLDABLEIDENTIFIERREFERENCEYESIFITISAREFERENCETOALOCALATEMPLATEWITHNOSUBSTITUTIONSYESATEMPLATEWITHSUBSTITUTIONSYESIFTHESUBSTITUTIONSAREFOLDABLELITERALSTRINGYESLITERALNUMBERYESLITERALBOOLEANYESLITERALNULLYESSUPPORTEDPREFIXOPERATORYESIFOPERANDISFOLDABLESUPPORTEDBINARYOPERATORYESIFBOTHLEFTANDRIGHTAREFOLDABLECONDITIONALOPERATORYESIFCONDITIONISFOLDABLEPARENTHESESYESIFTHEEXPRESSIONISFOLDABLE", - "original": "Syntax | Foldable\n----------------------------------- | -----------------------------\nLiteral object | yes\nLiteral array | yes\nSpread in literal array | no\nCalls | no\nNew | no\nProperty access | yes, if target is foldable\nArray index | yes, if target and index are foldable\nIdentifier reference | yes, if it is a reference to a local\nA template with no substitutions | yes\nA template with substitutions | yes, if the substitutions are foldable\nLiteral string | yes\nLiteral number | yes\nLiteral boolean | yes\nLiteral null | yes\nSupported prefix operator | yes, if operand is foldable\nSupported binary operator | yes, if both left and right are foldable\nConditional operator | yes, if condition is foldable\nParentheses | yes, if the expression is foldable", - "translation": "Syntax语法 | Foldable可折叠的\n----------------------------------- | -----------------------------\nLiteral object对象字面量 | yes \nLiteral array数组字面量 | yes \nSpread in literal array字面量数组展开 | no \nCalls调用 | no \nNew创建对象 | no \nProperty access属性访问 | yes, if target is foldable 是(如果目标也是可折叠的)\nArray index数组索引 | yes, if target and index are foldable 是(如果目标和索引也是可折叠的)\nIdentifier reference标识符引用 | yes, if it is a reference to a local 是(如果引用的是局部变量)\nA template with no substitutions没有内嵌表达式的模板 | yes \nA template with substitutions带内嵌表达式的模板 | yes, if the substitutions are foldable 是(如果内嵌表达式是可折叠的)\nLiteral string字符串字面量 | yes \nLiteral number数字字面量 | yes \nLiteral boolean逻辑字面量 | yes \nLiteral null空字面量 | yes \nSupported prefix operator受支持的前缀操作符 | yes, if operand is foldable 是(如果运算数是可折叠的)\nSupported binary operator受支持的二元操作符 | yes, if both left and right are foldable 是(如果左右运算数都是可折叠的)\nConditional operator条件操作符 | yes, if condition is foldable 是(如果条件是可折叠的)\nParentheses括号 | yes, if the expression is foldable 是(如果表达式是可折叠的)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "IFANEXPRESSIONISNOTFOLDABLETHECOLLECTORWRITESITTOMETADATAJSONASANASTHTTPS:ENWIKIPEDIAORGWIKIABSTRACTSYNTAXTREEFORTHECOMPILERTORESOLVE", - "original": "If an expression is not foldable, the collector writes it to `.metadata.json` as an [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) for the compiler to resolve.", - "translation": "如果表达式是不可折叠的,那么收集器就会把它作为一个 [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree)(抽象语法树) 写入 `.metadata.json` 中,留给编译器去解析。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##PHASE2:CODEGENERATION", - "original": "## Phase 2: code generation", - "translation": "## 阶段 2:代码生成", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOLLECTORMAKESNOATTEMPTTOUNDERSTANDTHEMETADATATHATITCOLLECTSANDOUTPUTSTOMETADATAJSONITREPRESENTSTHEMETADATAASBESTITCANANDRECORDSERRORSWHENITDETECTSAMETADATASYNTAXVIOLATION", - "original": "The _collector_ makes no attempt to understand the metadata that it collects and outputs to `.metadata.json`. It represents the metadata as best it can and records errors when it detects a metadata syntax violation.", - "translation": "*收集器*不会试图理解它收集并输出到 `.metadata.json` 中的元数据,它所能做的只是尽可能准确的表述这些元数据,并在检测到元数据中的语法违规时记录这些错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ITSTHECOMPILERSJOBTOINTERPRETTHEMETADATAJSONINTHECODEGENERATIONPHASE", - "original": "It's the compiler's job to interpret the `.metadata.json` in the code generation phase.", - "translation": "解释这些 `.metadata.json` 是编译器在代码生成阶段要承担的工作。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERUNDERSTANDSALLSYNTAXFORMSTHATTHECOLLECTORSUPPORTSBUTITMAYREJECTSYNTACTICALLYCORRECTMETADATAIFTHESEMANTICSVIOLATECOMPILERRULES", - "original": "The compiler understands all syntax forms that the _collector_ supports, but it may reject _syntactically_ correct metadata if the _semantics_ violate compiler rules.", - "translation": "编译器理解*收集器*支持的所有语法形式,但是它也可能拒绝那些虽然*语法正确*但*语义*违反了编译器规则的元数据。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERCANONLYREFERENCEEXPORTEDSYMBOLS", - "original": "The compiler can only reference _exported symbols_.", - "translation": "编译器只能引用*已导出的符号*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "DECORATEDCOMPONENTCLASSMEMBERSMUSTBEPUBLICYOUCANNOTMAKEANINPUTPROPERTYPRIVATEORINTERNAL", - "original": "Decorated component class members must be public. You cannot make an `@Input()` property private or internal.", - "translation": "带有装饰器的类成员必须是公开的。你不可能制作一个私有或内部使用的 `@Input()` 属性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "DATABOUNDPROPERTIESMUSTALSOBEPUBLIC", - "original": "Data bound properties must also be public.", - "translation": "数据绑定的属性同样必须是公开的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "MOSTIMPORTANTLYTHECOMPILERONLYGENERATESCODETOCREATEINSTANCESOFCERTAINCLASSESSUPPORTCERTAINDECORATORSANDCALLCERTAINFUNCTIONSFROMTHEFOLLOWINGLISTS", - "original": "Most importantly, the compiler only generates code to create instances of certain classes, support certain decorators, and call certain functions from the following lists.", - "translation": "最重要的是,编译器生成代码时,只支持为下面列出的某些类创建实例、只支持某些装饰器、只会调用某些函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###NEWINSTANCES", - "original": "### New instances", - "translation": "### 新建实例", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERONLYALLOWSMETADATATHATCREATEINSTANCESOFTHECLASSINJECTIONTOKENFROMANGULARCORE", - "original": "The compiler only allows metadata that create instances of the class `InjectionToken` from `@angular/core`.", - "translation": "编译器只允许创建来自 `@angular/core` 的 `InjectionToken` 类创建实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###ANNOTATIONSDECORATORS", - "original": "### Annotations/Decorators", - "translation": "### 注解 / 装饰器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERONLYSUPPORTSMETADATAFORTHESEANGULARDECORATORS", - "original": "The compiler only supports metadata for these Angular decorators.", - "translation": "编译器只支持下列 Angular 装饰器的元数据。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "DECORATORMODULEATTRIBUTEANGULARCORECOMPONENTANGULARCORECONTENTCHILDANGULARCORECONTENTCHILDRENANGULARCOREDIRECTIVEANGULARCOREHOSTANGULARCOREHOSTBINDINGANGULARCOREHOSTLISTENERANGULARCOREINJECTANGULARCOREINJECTABLEANGULARCOREINPUTANGULARCORENGMODULEANGULARCOREOPTIONALANGULARCOREOUTPUTANGULARCOREPIPEANGULARCORESELFANGULARCORESKIPSELFANGULARCOREVIEWCHILDANGULARCORE", - "original": "Decorator | Module\n------------------|--------------\n`Attribute` | `@angular/core`\n`Component` | `@angular/core`\n`ContentChild` | `@angular/core`\n`ContentChildren` | `@angular/core`\n`Directive` | `@angular/core`\n`Host` | `@angular/core`\n`HostBinding` | `@angular/core`\n`HostListener` | `@angular/core`\n`Inject` | `@angular/core`\n`Injectable` | `@angular/core`\n`Input` | `@angular/core`\n`NgModule` | `@angular/core`\n`Optional` | `@angular/core`\n`Output` | `@angular/core`\n`Pipe` | `@angular/core`\n`Self` | `@angular/core`\n`SkipSelf` | `@angular/core`\n`ViewChild` | `@angular/core`", - "translation": "Decorator装饰器 | Module所在模块\n------------------|--------------\n`Attribute` | `@angular/core`\n`Component` | `@angular/core`\n`ContentChild` | `@angular/core`\n`ContentChildren` | `@angular/core`\n`Directive` | `@angular/core`\n`Host` | `@angular/core`\n`HostBinding` | `@angular/core`\n`HostListener` | `@angular/core`\n`Inject` | `@angular/core`\n`Injectable` | `@angular/core`\n`Input` | `@angular/core`\n`NgModule` | `@angular/core`\n`Optional` | `@angular/core`\n`Output` | `@angular/core`\n`Pipe` | `@angular/core`\n`Self` | `@angular/core`\n`SkipSelf` | `@angular/core`\n`ViewChild` | `@angular/core`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###MACROFUNCTIONSANDMACROSTATICMETHODS", - "original": "### Macro-functions and macro-static methods", - "translation": "### 宏函数或静态宏函数", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERALSOSUPPORTSMACROSINTHEFORMOFFUNCTIONSORSTATICMETHODSTHATRETURNANEXPRESSION", - "original": "The compiler also supports _macros_ in the form of functions or static\nmethods that return an expression.", - "translation": "编译器也支持在返回表达式的函数或静态函数中使用*宏*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "FOREXAMPLECONSIDERTHEFOLLOWINGFUNCTION:", - "original": "For example, consider the following function:", - "translation": "考虑下面的函数:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUCANCALLTHEWRAPINARRAYINAMETADATADEFINITIONBECAUSEITRETURNSTHEVALUEOFANEXPRESSIONTHATCONFORMSTOTHECOMPILERSRESTRICTIVEJAVASCRIPTSUBSET", - "original": "You can call the `wrapInArray` in a metadata definition because it returns the value of an expression that conforms to the compiler's restrictive JavaScript subset.", - "translation": "你可以在元数据定义中调用 `wrapInArray`,因为它所返回的表达式的值满足编译器支持的 JavaScript 受限子集。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUMIGHTUSEWRAPINARRAYLIKETHIS:", - "original": "You might use `wrapInArray()` like this:", - "translation": "你还可以这样使用 `wrapInArray()`:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERTREATSTHISUSAGEASIFYOUHADWRITTEN:", - "original": "The compiler treats this usage as if you had written:", - "translation": "编译器会把这种用法处理成你以前的写法:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOLLECTORISSIMPLISTICINITSDETERMINATIONOFWHATQUALIFIESASAMACROFUNCTIONITCANONLYCONTAINASINGLERETURNSTATEMENT", - "original": "The collector is simplistic in its determination of what qualifies as a macro\nfunction; it can only contain a single `return` statement.", - "translation": "收集器决定哪些函数是宏函数是很简单的 —— 它只能包含一个 `return` 语句。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEANGULARROUTERMODULEAPIROUTERROUTERMODULEEXPORTSTWOMACROSTATICMETHODSFORROOTANDFORCHILDTOHELPDECLAREROOTANDCHILDROUTESREVIEWTHESOURCECODEHTTPS:GITHUBCOMANGULARANGULARBLOBMASTERPACKAGESROUTERSRCROUTERMODULETS#L139ROUTERMODULEFORROOTSOURCECODEFORTHESEMETHODSTOSEEHOWMACROSCANSIMPLIFYCONFIGURATIONOFCOMPLEXNGMODULESGUIDENGMODULES", - "original": "The Angular [`RouterModule`](api/router/RouterModule) exports two macro static methods, `forRoot` and `forChild`, to help declare root and child routes.\nReview the [source code](https://github.com/angular/angular/blob/master/packages/router/src/router_module.ts#L139 \"RouterModule.forRoot source code\")\nfor these methods to see how macros can simplify configuration of complex [NgModules](guide/ngmodules).", - "translation": "Angular 的 [`RouterModule`](api/router/RouterModule) 导出了两个静态宏函数 `forRoot` 和 `forChild`,以帮助声明根路由和子路由。\n查看这些方法的[源码](https://github.com/angular/angular/blob/master/packages/router/src/router_module.ts#L139 \"RouterModule.forRoot source code\"),以了解宏函数是如何简化复杂的 [NgModule](guide/ngmodules) 配置的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###METADATAREWRITING", - "original": "### Metadata rewriting", - "translation": "### 元数据重写", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERTREATSOBJECTLITERALSCONTAININGTHEFIELDSUSECLASSUSEVALUEUSEFACTORYANDDATASPECIALLYTHECOMPILERCONVERTSTHEEXPRESSIONINITIALIZINGONEOFTHESEFIELDSINTOANEXPORTEDVARIABLEWHICHREPLACESTHEEXPRESSIONTHISPROCESSOFREWRITINGTHESEEXPRESSIONSREMOVESALLTHERESTRICTIONSONWHATCANBEINTHEMBECAUSETHECOMPILERDOESNTNEEDTOKNOWTHEEXPRESSIONSVALUEMDASHITJUSTNEEDSTOBEABLETOGENERATEAREFERENCETOTHEVALUE", - "original": "The compiler treats object literals containing the fields `useClass`, `useValue`, `useFactory`, and `data` specially. The compiler converts the expression initializing one of these fields into an exported variable, which replaces the expression. This process of rewriting these expressions removes all the restrictions on what can be in them because\nthe compiler doesn't need to know the expression's value—it just needs to be able to generate a reference to the value.", - "translation": "编译器会对含有 `useClass`、`useValue`、`useFactory` 和 `data` 的对象字面量进行特殊处理。\n编译器会把用这些字段之一初始化的表达式转换成一个导出为一个变量,并用它替换该表达式。\n这个重写表达式的过程,会消除它们受到的所有限制,因为编译器并不需要知道该表达式的值,它只要能生成对该值的引用就行了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUMIGHTWRITESOMETHINGLIKE:", - "original": "You might write something like:", - "translation": "你可以这样写:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "WITHOUTREWRITINGTHISWOULDBEINVALIDBECAUSELAMBDASARENOTSUPPORTEDANDTYPICALSERVERISNOTEXPORTED", - "original": "Without rewriting, this would be invalid because lambdas are not supported and `TypicalServer` is not exported.", - "translation": "如果不重写,这就是无效的,因为这里不支持 Lambda 表达式,而且 `TypicalServer` 也没有被导出。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "TOALLOWTHISTHECOMPILERAUTOMATICALLYREWRITESTHISTOSOMETHINGLIKE:", - "original": "To allow this, the compiler automatically rewrites this to something like:", - "translation": "为了允许这种写法,编译器自动把它重写成了这样:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISALLOWSTHECOMPILERTOGENERATEAREFERENCETO0INTHEFACTORYWITHOUTHAVINGTOKNOWWHATTHEVALUEOF0CONTAINS", - "original": "This allows the compiler to generate a reference to `ɵ0` in the\nfactory without having to know what the value of `ɵ0` contains.", - "translation": "这就让编译器能在工厂中生成一个对 `ɵ0` 的引用,而不用知道 `ɵ0` 中包含的值到底是什么。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERDOESTHEREWRITINGDURINGTHEEMITOFTHEJSFILETHISDOESNTREWRITETHEDTSFILEHOWEVERSOTYPESCRIPTDOESNTRECOGNIZEITASBEINGANEXPORTTHUSITDOESNOTPOLLUTETHEESMODULESEXPORTEDAPI", - "original": "The compiler does the rewriting during the emit of the `.js` file. This doesn't rewrite the `.d.ts` file, however, so TypeScript doesn't recognize it as being an export. Thus, it does not pollute the ES module's exported API.", - "translation": "编译器会在生成 `.js` 文件期间进行这种重写。它不会重写 `.d.ts` 文件,所以 TypeScript 也不会把这个变量当做一项导出,因此也就不会污染 ES 模块中导出的 API。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##METADATAERRORS", - "original": "## Metadata Errors", - "translation": "## 元数据错误", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEFOLLOWINGAREMETADATAERRORSYOUMAYENCOUNTERWITHEXPLANATIONSANDSUGGESTEDCORRECTIONS", - "original": "The following are metadata errors you may encounter, with explanations and suggested corrections.", - "translation": "你可能遇到一些元数据错误,下面是对它们的解释和纠正建议。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "EXPRESSIONFORMNOTSUPPORTED#EXPRESSIONFORMNOTSUPPORTEDBRREFERENCETOALOCALNONEXPORTEDSYMBOL#REFERENCETOALOCALSYMBOLBRONLYINITIALIZEDVARIABLESANDCONSTANTS#ONLYINITIALIZEDVARIABLESBRREFERENCETOANONEXPORTEDCLASS#REFERENCETOANONEXPORTEDCLASSBRREFERENCETOANONEXPORTEDFUNCTION#REFERENCETOANONEXPORTEDFUNCTIONBRFUNCTIONCALLSARENOTSUPPORTED#FUNCTIONCALLSNOTSUPPORTEDBRDESTRUCTUREDVARIABLEORCONSTANTNOTSUPPORTED#DESTRUCTUREDVARIABLENOTSUPPORTEDBRCOULDNOTRESOLVETYPE#COULDNOTRESOLVETYPEBRNAMEEXPECTED#NAMEEXPECTEDBRUNSUPPORTEDENUMMEMBERNAME#UNSUPPORTEDENUMMEMBERNAMEBRTAGGEDTEMPLATEEXPRESSIONSARENOTSUPPORTED#TAGGEDTEMPLATEEXPRESSIONSNOTSUPPORTEDBRSYMBOLREFERENCEEXPECTED#SYMBOLREFERENCEEXPECTEDBR", - "original": "[Expression form not supported](#expression-form-not-supported)
\n[Reference to a local (non-exported) symbol](#reference-to-a-local-symbol)
\n[Only initialized variables and constants](#only-initialized-variables)
\n[Reference to a non-exported class](#reference-to-a-non-exported-class)
\n[Reference to a non-exported function](#reference-to-a-non-exported-function)
\n[Function calls are not supported](#function-calls-not-supported)
\n[Destructured variable or constant not supported](#destructured-variable-not-supported)
\n[Could not resolve type](#could-not-resolve-type)
\n[Name expected](#name-expected)
\n[Unsupported enum member name](#unsupported-enum-member-name)
\n[Tagged template expressions are not supported](#tagged-template-expressions-not-supported)
\n[Symbol reference expected](#symbol-reference-expected)
", - "translation": "[Expression form not supported【不支持此表达式格式】](#expression-form-not-supported)
\n[Reference to a local (non-exported) symbol【引用了局部(未导出的)符号】](#reference-to-a-local-symbol)
\n[Only initialized variables and constants【只允许初始化过的变量和常量】](#only-initialized-variables)
\n[Reference to a non-exported class【引用了未导出的类】](#reference-to-a-non-exported-class)
\n[Reference to a non-exported function【引用了未导出的函数】](#reference-to-a-non-exported-function)
\n[Function calls are not supported【不支持函数调用】](#function-calls-not-supported)
\n[Destructured variable or constant not supported【不支持解构变量或常量】](#destructured-variable-not-supported)
\n[Could not resolve type【不能解析此类型】](#could-not-resolve-type)
\n[Name expected【期待是名字】](#name-expected)
\n[Unsupported enum member name【不支持的枚举成员名】](#unsupported-enum-member-name)
\n[Tagged template expressions are not supported【不支持带标签函数的模板表达式】](#tagged-template-expressions-not-supported)
\n[Symbol reference expected【期待是符号引用】](#symbol-reference-expected)
", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCEXPRESSIONFORMNOTSUPPORTEDH3", - "original": "

Expression form not supported

", - "translation": "

不支持这种表达式格式

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERENCOUNTEREDANEXPRESSIONITDIDNTUNDERSTANDWHILEEVALUATINGANGULARMETADATA", - "original": "The compiler encountered an expression it didn't understand while evaluating Angular metadata.", - "translation": "编译器在对 Angular 元数据求值时遇到了一个它不能理解的表达式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "LANGUAGEFEATURESOUTSIDEOFTHECOMPILERSRESTRICTEDEXPRESSIONSYNTAX#EXPRESSIONSYNTAXCANPRODUCETHISERRORASSEENINTHEFOLLOWINGEXAMPLE:", - "original": "Language features outside of the compiler's [restricted expression syntax](#expression-syntax)\ncan produce this error, as seen in the following example:", - "translation": "除编译器[允许的表达式语法](#expression-syntax)之外的语言特性可能导致这个错误,比如下面的例子:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUCANUSETYPEOFANDBRACKETNOTATIONINNORMALAPPLICATIONCODEYOUJUSTCANTUSETHOSEFEATURESWITHINEXPRESSIONSTHATDEFINEANGULARMETADATA", - "original": "You can use `typeof` and bracket notation in normal application code.\nYou just can't use those features within expressions that define Angular metadata.", - "translation": "你可以在普通的应用代码中使用 `typeof` 和方括号标记法来指定属性名,但是这些特性不能在定义 Angular 元数据的表达式中使用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "AVOIDTHISERRORBYSTICKINGTOTHECOMPILERSRESTRICTEDEXPRESSIONSYNTAX#EXPRESSIONSYNTAXWHENWRITINGANGULARMETADATAANDBEWARYOFNEWORUNUSUALTYPESCRIPTFEATURES", - "original": "Avoid this error by sticking to the compiler's [restricted expression syntax](#expression-syntax)\nwhen writing Angular metadata\nand be wary of new or unusual TypeScript features.", - "translation": "在写 Angular 的元数据时,严格遵循编译器的[受限表达式语法](#expression-syntax)可以避免这个错误,此外还要小心那些新的或罕见的 TypeScript 特性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCREFERENCETOALOCALNONEXPORTEDSYMBOLH3", - "original": "

Reference to a local (non-exported) symbol

", - "translation": "

引用了局部(未导出的)符号

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERENCOUNTEREDAREFERENCEDTOALOCALLYDEFINEDSYMBOLTHATEITHERWASNTEXPORTEDORWASNTINITIALIZED", - "original": "The compiler encountered a referenced to a locally defined symbol that either wasn't exported or wasn't initialized.", - "translation": "编译器遇到了局部定义的未导出或未初始化的符号。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "HERESAPROVIDEREXAMPLEOFTHEPROBLEM", - "original": "Here's a `provider` example of the problem.", - "translation": "下面就是存在该问题的 `provider` 范例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERGENERATESTHECOMPONENTFACTORYWHICHINCLUDESTHEUSEVALUEPROVIDERCODEINASEPARATEMODULETHATFACTORYMODULECANTREACHBACKTOTHISSOURCEMODULETOACCESSTHELOCALNONEXPORTEDFOOVARIABLE", - "original": "The compiler generates the component factory, which includes the `useValue` provider code, in a separate module. _That_ factory module can't reach back to _this_ source module to access the local (non-exported) `foo` variable.", - "translation": "编译器会在单独的模块中生成这个 `userValue` 提供商的代码。*那个*工厂模块不能访问*这个*源码模块,无法访问这个(未导出的)`foo` 变量。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUCOULDFIXTHEPROBLEMBYINITIALIZINGFOO", - "original": "You could fix the problem by initializing `foo`.", - "translation": "你可以通过初始化 `foo` 来修正这个错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERWILLFOLD#FOLDINGTHEEXPRESSIONINTOTHEPROVIDERASIFYOUHADWRITTENTHIS", - "original": "The compiler will [fold](#folding) the expression into the provider as if you had written this.", - "translation": "编译器将会把这个表达式[折叠](#folding)进 `providers` 中,就像你以前的写法一样。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ALTERNATIVELYYOUCANFIXITBYEXPORTINGFOOWITHTHEEXPECTATIONTHATFOOWILLBEASSIGNEDATRUNTIMEWHENYOUACTUALLYKNOWITSVALUE", - "original": "Alternatively, you can fix it by exporting `foo` with the expectation that `foo` will be assigned at runtime when you actually know its value.", - "translation": "另外,你也可以通过导出 `foo` 来解决它,这样 `foo` 将会在运行期间你真正知道它的值的时候被赋值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ADDINGEXPORTOFTENWORKSFORVARIABLESREFERENCEDINMETADATASUCHASPROVIDERSANDANIMATIONSBECAUSETHECOMPILERCANGENERATEREFERENCESTOTHEEXPORTEDVARIABLESINTHESEEXPRESSIONSITDOESNTNEEDTHEVALUESOFTHOSEVARIABLES", - "original": "Adding `export` often works for variables referenced in metadata such as `providers` and `animations` because the compiler can generate _references_ to the exported variables in these expressions. It doesn't need the _values_ of those variables.", - "translation": "添加 `export` 的方式通常用于需要在元数据中引用变量时,如 `providers` 和 `animations`,这样编译器就可以在这些表达式中生成对已导出变量的引用了。它不需要知道这些变量的*值*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ADDINGEXPORTDOESNTWORKWHENTHECOMPILERNEEDSTHEACTUALVALUEINORDERTOGENERATECODEFOREXAMPLEITDOESNTWORKFORTHETEMPLATEPROPERTY", - "original": "Adding `export` doesn't work when the compiler needs the _actual value_\nin order to generate code.\nFor example, it doesn't work for the `template` property.", - "translation": "当编译器需要知道*真正的值*已生成代码时,添加 `export` 的方式就是无效的。比如这里的 `template` 属性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERNEEDSTHEVALUEOFTHETEMPLATEPROPERTYRIGHTNOWTOGENERATETHECOMPONENTFACTORYTHEVARIABLEREFERENCEALONEISINSUFFICIENTPREFIXINGTHEDECLARATIONWITHEXPORTMERELYPRODUCESANEWERRORONLYINITIALIZEDVARIABLESANDCONSTANTSCANBEREFERENCED#ONLYINITIALIZEDVARIABLES", - "original": "The compiler needs the value of the `template` property _right now_ to generate the component factory.\nThe variable reference alone is insufficient.\nPrefixing the declaration with `export` merely produces a new error, \"[`Only initialized variables and constants can be referenced`](#only-initialized-variables)\".", - "translation": "编译器*现在就*需要 `template` 属性的值来生成组件工厂。\n仅仅有对该变量的引用是不够的。\n给这个声明加上 `export` 前缀只会生成一个新的错误 \"[`Only initialized variables and constants can be referenced`【只能引用初始化过的变量和常量】](#only-initialized-variables)\"。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCONLYINITIALIZEDVARIABLESANDCONSTANTSH3", - "original": "

Only initialized variables and constants

", - "translation": "

只允许使用初始化过的变量和常量

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERFOUNDAREFERENCETOANEXPORTEDVARIABLEORSTATICFIELDTHATWASNTINITIALIZEDITNEEDSTHEVALUEOFTHATVARIABLETOGENERATECODE", - "original": "The compiler found a reference to an exported variable or static field that wasn't initialized.\nIt needs the value of that variable to generate code.", - "translation": "编译器发现某个到已导出的变量或静态字段的引用是没有初始化过的。而它需要根据那个变量的值来生成代码。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEFOLLOWINGEXAMPLETRIESTOSETTHECOMPONENTSTEMPLATEPROPERTYTOTHEVALUEOFTHEEXPORTEDSOMETEMPLATEVARIABLEWHICHISDECLAREDBUTUNASSIGNED", - "original": "The following example tries to set the component's `template` property to the value of\nthe exported `someTemplate` variable which is declared but _unassigned_.", - "translation": "下面的例子试图把组件的 ` template` 属性设置为已导出的 `someTemplate` 变量的值,而这个值虽然声明过,却没有初始化过。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUDALSOGETTHISERRORIFYOUIMPORTEDSOMETEMPLATEFROMSOMEOTHERMODULEANDNEGLECTEDTOINITIALIZEITTHERE", - "original": "You'd also get this error if you imported `someTemplate` from some other module and neglected to initialize it there.", - "translation": "如果你从其它模块中导入了 `someTemplate`,但那个模块中忘了初始化它,就会看到这个错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERCANNOTWAITUNTILRUNTIMETOGETTHETEMPLATEINFORMATIONITMUSTSTATICALLYDERIVETHEVALUEOFTHESOMETEMPLATEVARIABLEFROMTHESOURCECODESOTHATITCANGENERATETHECOMPONENTFACTORYWHICHINCLUDESINSTRUCTIONSFORBUILDINGTHEELEMENTBASEDONTHETEMPLATE", - "original": "The compiler cannot wait until runtime to get the template information.\nIt must statically derive the value of the `someTemplate` variable from the source code\nso that it can generate the component factory, which includes\ninstructions for building the element based on the template.", - "translation": "编译器不能等到运行时才得到该模板的信息。\n它必须从源码中静态获得这个 `someTemplate` 变量的值,以便生成组件工厂,组件工厂中需要包含根据这个模板来生成元素的代码。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "TOCORRECTTHISERRORPROVIDETHEINITIALVALUEOFTHEVARIABLEINANINITIALIZERCLAUSEONTHESAMELINE", - "original": "To correct this error, provide the initial value of the variable in an initializer clause _on the same line_.", - "translation": "要纠正这个错误,请在*同一行*的初始化子句中初始化这个变量的值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCREFERENCETOANONEXPORTEDCLASSH3", - "original": "

Reference to a non-exported class

", - "translation": "

引用了未导出的类

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "METADATAREFERENCEDACLASSTHATWASNTEXPORTED", - "original": "Metadata referenced a class that wasn't exported.", - "translation": "元数据引用了一个未导出的类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "FOREXAMPLEYOUMAYHAVEDEFINEDACLASSANDUSEDITASANINJECTIONTOKENINAPROVIDERSARRAYBUTNEGLECTEDTOEXPORTTHATCLASS", - "original": "For example, you may have defined a class and used it as an injection token in a providers array\nbut neglected to export that class.", - "translation": "比如,你可能定义了一个类并在某个 `providers` 数组中把它用作了依赖注入令牌,但是忘了导出这个类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ANGULARGENERATESACLASSFACTORYINASEPARATEMODULEANDTHATFACTORYCANONLYACCESSEXPORTEDCLASSES#EXPORTEDSYMBOLSTOCORRECTTHISERROREXPORTTHEREFERENCEDCLASS", - "original": "Angular generates a class factory in a separate module and that\nfactory [can only access exported classes](#exported-symbols).\nTo correct this error, export the referenced class.", - "translation": "Angular 会在一个单独的模块中生成类工厂,而那个工厂[只能访问已导出的类](#exported-symbols)。\n要纠正这个问题,就要导出所引用的类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCREFERENCETOANONEXPORTEDFUNCTIONH3", - "original": "

Reference to a non-exported function

", - "translation": "

引用了未导出的函数

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "METADATAREFERENCEDAFUNCTIONTHATWASNTEXPORTED", - "original": "Metadata referenced a function that wasn't exported.", - "translation": "元数据中引用了未导出的函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "FOREXAMPLEYOUMAYHAVESETAPROVIDERSUSEFACTORYPROPERTYTOALOCALLYDEFINEDFUNCTIONTHATYOUNEGLECTEDTOEXPORT", - "original": "For example, you may have set a providers `useFactory` property to a locally defined function that you neglected to export.", - "translation": "比如,你可能已经把某个服务提供商的 `useFactory` 属性设置成了一个局部定义但忘了导出的函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ANGULARGENERATESACLASSFACTORYINASEPARATEMODULEANDTHATFACTORYCANONLYACCESSEXPORTEDFUNCTIONS#EXPORTEDSYMBOLSTOCORRECTTHISERROREXPORTTHEFUNCTION", - "original": "Angular generates a class factory in a separate module and that\nfactory [can only access exported functions](#exported-symbols).\nTo correct this error, export the function.", - "translation": "Angular 会在一个单独的模块中生成类工厂,那个工厂[只能访问已导出的函数](#exported-symbols)。\n要纠正这个错误,请导出该函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCFUNCTIONCALLSARENOTSUPPORTEDH3", - "original": "

Function calls are not supported

", - "translation": "

不支持函数调用

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERDOESNOTCURRENTLYSUPPORTFUNCTIONEXPRESSIONSORLAMBDAFUNCTIONS#FUNCTIONEXPRESSIONFOREXAMPLEYOUCANNOTSETAPROVIDERSUSEFACTORYTOANANONYMOUSFUNCTIONORARROWFUNCTIONLIKETHIS", - "original": "The compiler does not currently support [function expressions or lambda functions](#function-expression).\nFor example, you cannot set a provider's `useFactory` to an anonymous function or arrow function like this.", - "translation": "编译器目前不支持[函数表达式或 Lambda 表达式](#function-expression)。\n比如,你不能把某个服务提供商的 `useFactory` 设置成如下匿名函数或函数表达式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOUALSOGETTHISERRORIFYOUCALLAFUNCTIONORMETHODINAPROVIDERSUSEVALUE", - "original": "You also get this error if you call a function or method in a provider's `useValue`.", - "translation": "如果你在某个提供商的 `useValue` 中调用函数或方法,也会导致这个错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "TOCORRECTTHISERROREXPORTAFUNCTIONFROMTHEMODULEANDREFERTOTHEFUNCTIONINAUSEFACTORYPROVIDERINSTEAD", - "original": "To correct this error, export a function from the module and refer to the function in a `useFactory` provider instead.", - "translation": "要改正这个问题,就要从模块中导出这个函数,并改成在服务提供商的 `useFactory` 中引用该函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCDESTRUCTUREDVARIABLEORCONSTANTNOTSUPPORTEDH3", - "original": "

Destructured variable or constant not supported

", - "translation": "

不支持解构变量或常量

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERDOESNOTSUPPORTREFERENCESTOVARIABLESASSIGNEDBYDESTRUCTURINGHTTPS:WWWTYPESCRIPTLANGORGDOCSHANDBOOKVARIABLEDECLARATIONSHTML#DESTRUCTURING", - "original": "The compiler does not support references to variables assigned by [destructuring](https://www.typescriptlang.org/docs/handbook/variable-declarations.html#destructuring).", - "translation": "编译器不支持引用通过[解构](https://www.typescriptlang.org/docs/handbook/variable-declarations.html#destructuring)赋值的方式得到的变量。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "FOREXAMPLEYOUCANNOTWRITESOMETHINGLIKETHIS:", - "original": "For example, you cannot write something like this:", - "translation": "比如,你不能这么写:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "TOCORRECTTHISERRORREFERTONONDESTRUCTUREDVALUES", - "original": "To correct this error, refer to non-destructured values.", - "translation": "要纠正这个错误,就要引用非解构方式的变量。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCCOULDNOTRESOLVETYPEH3", - "original": "

Could not resolve type

", - "translation": "

不能解析类型

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERENCOUNTEREDATYPEANDCANTDETERMINEWHICHMODULEEXPORTSTHATTYPE", - "original": "The compiler encountered a type and can't determine which module exports that type.", - "translation": "编译器遇到了某个类型,但是不知道它是由哪个模块导出的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISCANHAPPENIFYOUREFERTOANAMBIENTTYPEFOREXAMPLETHEWINDOWTYPEISANAMBIENTTYPEDECLAREDINTHEGLOBALDTSFILE", - "original": "This can happen if you refer to an ambient type.\nFor example, the `Window` type is an ambient type declared in the global `.d.ts` file.", - "translation": "这通常会发生在你引用环境类型时。\n比如,`Window` 类型就是在全局 `.d.ts` 文件中声明的环境类型。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "YOULLGETANERRORIFYOUREFERENCEITINTHECOMPONENTCONSTRUCTORWHICHTHECOMPILERMUSTSTATICALLYANALYZE", - "original": "You'll get an error if you reference it in the component constructor,\nwhich the compiler must statically analyze.", - "translation": "如果你在组件的构造函数中引用它就会导致一个错误,因为编译器必须对构造函数进行静态分析。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "TYPESCRIPTUNDERSTANDSAMBIENTTYPESSOYOUDONTIMPORTTHEMTHEANGULARCOMPILERDOESNOTUNDERSTANDATYPETHATYOUNEGLECTTOEXPORTORIMPORT", - "original": "TypeScript understands ambient types so you don't import them.\nThe Angular compiler does not understand a type that you neglect to export or import.", - "translation": "TypeScript 能理解这些环境类型,所以你不用导入它们。\n但 Angular 编译器不理解你没有导入或导出过的类型。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "INTHISCASETHECOMPILERDOESNTUNDERSTANDHOWTOINJECTSOMETHINGWITHTHEWINDOWTOKEN", - "original": "In this case, the compiler doesn't understand how to inject something with the `Window` token.", - "translation": "这种情况下,编译器就无法理解如何使用这个 `Window` 令牌来进行注入。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "DONOTREFERTOAMBIENTTYPESINMETADATAEXPRESSIONS", - "original": "Do not refer to ambient types in metadata expressions.", - "translation": "不要在元数据表达式中引用环境类型。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "IFYOUMUSTINJECTANINSTANCEOFANAMBIENTTYPEYOUCANFINESSETHEPROBLEMINFOURSTEPS:", - "original": "If you must inject an instance of an ambient type,\nyou can finesse the problem in four steps:", - "translation": "如果你必须注入某个环境类型的实例,可以用以下四步来巧妙解决这个问题:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "1CREATEANINJECTIONTOKENFORANINSTANCEOFTHEAMBIENTTYPE", - "original": "1. Create an injection token for an instance of the ambient type.", - "translation": "为环境类型的实例创建一个注入令牌。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "1CREATEAFACTORYFUNCTIONTHATRETURNSTHATINSTANCE", - "original": "1. Create a factory function that returns that instance.", - "translation": "创建一个返回该实例的工厂函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "1ADDAUSEFACTORYPROVIDERWITHTHATFACTORYFUNCTION", - "original": "1. Add a `useFactory` provider with that factory function.", - "translation": "使用该工厂函数添加一个 `useFactory` 提供商。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "1USEINJECTTOINJECTTHEINSTANCE", - "original": "1. Use `@Inject` to inject the instance.", - "translation": "使用 `@Inject` 来注入这个实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "HERESANILLUSTRATIVEEXAMPLE", - "original": "Here's an illustrative example.", - "translation": "下面的例子说明了这一点。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEWINDOWTYPEINTHECONSTRUCTORISNOLONGERAPROBLEMFORTHECOMPILERBECAUSEITUSESTHEINJECTWINDOWTOGENERATETHEINJECTIONCODE", - "original": "The `Window` type in the constructor is no longer a problem for the compiler because it\nuses the `@Inject(WINDOW)` to generate the injection code.", - "translation": "对于编译器来说,构造函数中出现 `Window` 类型已不再是个问题,因为它现在使用 `@Inject(WINDOW)` 来生成注入代码。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ANGULARDOESSOMETHINGSIMILARWITHTHEDOCUMENTTOKENSOYOUCANINJECTTHEBROWSERSDOCUMENTOBJECTORANABSTRACTIONOFITDEPENDINGUPONTHEPLATFORMINWHICHTHEAPPLICATIONRUNS", - "original": "Angular does something similar with the `DOCUMENT` token so you can inject the browser's `document` object (or an abstraction of it, depending upon the platform in which the application runs).", - "translation": "Angular 也用 `DOCUMENT` 令牌做了类似的事情,所以你也可以注入浏览器的 `document` 对象(或它的一个抽象层,取决于该应用运行在哪个平台)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCNAMEEXPECTEDH3", - "original": "

Name expected

", - "translation": "

期待是名字

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILEREXPECTEDANAMEINANEXPRESSIONITWASEVALUATINGTHISCANHAPPENIFYOUUSEANUMBERASAPROPERTYNAMEASINTHEFOLLOWINGEXAMPLE", - "original": "The compiler expected a name in an expression it was evaluating.\nThis can happen if you use a number as a property name as in the following example.", - "translation": "编译器期待它正在求值的表达式中是一个名字。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "CHANGETHENAMEOFTHEPROPERTYTOSOMETHINGNONNUMERIC", - "original": "Change the name of the property to something non-numeric.", - "translation": "把该属性的名字改为非数字类型。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCUNSUPPORTEDENUMMEMBERNAMEH3", - "original": "

Unsupported enum member name

", - "translation": "

不支持的枚举成员名

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "ANGULARCOULDNTDETERMINETHEVALUEOFTHEENUMMEMBERHTTPS:WWWTYPESCRIPTLANGORGDOCSHANDBOOKENUMSHTMLTHATYOUREFERENCEDINMETADATA", - "original": "Angular couldn't determine the value of the [enum member](https://www.typescriptlang.org/docs/handbook/enums.html)\nthat you referenced in metadata.", - "translation": "Angular 不能确定你在元数据中引用的[枚举成员](https://www.typescriptlang.org/docs/handbook/enums.html)的值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERCANUNDERSTANDSIMPLEENUMVALUESBUTNOTCOMPLEXVALUESSUCHASTHOSEDERIVEDFROMCOMPUTEDPROPERTIES", - "original": "The compiler can understand simple enum values but not complex values such as those derived from computed properties.", - "translation": "编译器可以理解简单的枚举值,但不能理解复杂的,比如从那些计算属性中派生出来的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "AVOIDREFERRINGTOENUMSWITHCOMPLICATEDINITIALIZERSORCOMPUTEDPROPERTIES", - "original": "Avoid referring to enums with complicated initializers or computed properties.", - "translation": "避免引用那些使用了复杂初始化对象或计算属性的枚举。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCTAGGEDTEMPLATEEXPRESSIONSARENOTSUPPORTEDH3", - "original": "

Tagged template expressions are not supported

", - "translation": "

不支持带标签函数的模板表达式

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILERENCOUNTEREDAJAVASCRIPTES2015TAGGEDTEMPLATEEXPRESSIONHTTPS:DEVELOPERMOZILLAORGENUSDOCSWEBJAVASCRIPTREFERENCETEMPLATELITERALS#TAGGEDTEMPLATELITERALSSUCHAS", - "original": "The compiler encountered a JavaScript ES2015 [tagged template expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals) such as,", - "translation": "当编译器遇到这样的[带标签函数的模板表达式](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals) 时:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "STRINGRAWHTTPS:DEVELOPERMOZILLAORGENUSDOCSWEBJAVASCRIPTREFERENCEGLOBALOBJECTSSTRINGRAWISATAGFUNCTIONNATIVETOJAVASCRIPTES2015", - "original": "[`String.raw()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw)\nis a _tag function_ native to JavaScript ES2015.", - "translation": "[`String.raw()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw) 是一个 ES2015 原生的*标签函数*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEAOTCOMPILERDOESNOTSUPPORTTAGGEDTEMPLATEEXPRESSIONSAVOIDTHEMINMETADATAEXPRESSIONS", - "original": "The AOT compiler does not support tagged template expressions; avoid them in metadata expressions.", - "translation": "AOT 编译器不支持带标签函数的模板表达式,避免在元数据表达式中使用它们。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "H3CLASSNOTOCSYMBOLREFERENCEEXPECTEDH3", - "original": "

Symbol reference expected

", - "translation": "

期待是符号引用

", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THECOMPILEREXPECTEDAREFERENCETOASYMBOLATTHELOCATIONSPECIFIEDINTHEERRORMESSAGE", - "original": "The compiler expected a reference to a symbol at the location specified in the error message.", - "translation": "编译器期待在错误信息指出的位置是一个符号引用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISERRORCANOCCURIFYOUUSEANEXPRESSIONINTHEEXTENDSCLAUSEOFACLASS", - "original": "This error can occur if you use an expression in the `extends` clause of a class.", - "translation": "当你在类的 `extends` 子句中使用表达式时就会出现这个错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##PHASE3:BINDINGEXPRESSIONVALIDATION", - "original": "## Phase 3: binding expression validation", - "translation": "## 阶段 3:验证绑定表达式", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "INTHEVALIDATIONPHASETHEANGULARTEMPLATECOMPILERUSESTHETYPESCRIPTCOMPILERTOVALIDATETHEBINDINGEXPRESSIONSINTEMPLATESENABLETHISPHASEEXPLICITLYBYADDINGTHECOMPILEROPTIONFULLTEMPLATETYPECHECKINTHEANGULARCOMPILEROPTIONSOFTHEPROJECTSTSCONFIGJSONSEEANGULARCOMPILEROPTIONS#COMPILEROPTIONS", - "original": "In the validation phase, the Angular template compiler uses the TypeScript compiler to validate the\n binding expressions in templates. Enable this phase explicitly by adding the compiler\n option `\"fullTemplateTypeCheck\"` in the `\"angularCompilerOptions\"` of the project's `tsconfig.json` (see\n [Angular Compiler Options](#compiler-options)).", - "translation": "在验证阶段,Angular 的模板编译器会使用 TypeScript 编译器来验证模板中的绑定表达式。\n 通过在项目的 `tsconfig.json`(参见 [Angular Compiler Options](#compiler-options))的 `\"angularCompilerOptions\"` 中添加编译选项 `\"fullTemplateTypeCheck\"` 可以启用这个阶段。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "TEMPLATEVALIDATIONPRODUCESERRORMESSAGESWHENATYPEERRORISDETECTEDINATEMPLATEBINDINGEXPRESSIONSIMILARTOHOWTYPEERRORSAREREPORTEDBYTHETYPESCRIPTCOMPILERAGAINSTCODEINATSFILE", - "original": "Template validation produces error messages when a type error is detected in a template binding\n expression, similar to how type errors are reported by the TypeScript compiler against code in a `.ts`\n file.", - "translation": "当模板绑定表达式中检测到类型错误时,进行模板验证时就会生成错误。这和 TypeScript 编译器在处理 `.ts` 文件中的代码时报告错误很相似。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "FOREXAMPLECONSIDERTHEFOLLOWINGCOMPONENT:", - "original": "For example, consider the following component:", - "translation": "比如,考虑下列组件:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISWILLPRODUCETHEFOLLOWINGERROR:", - "original": "This will produce the following error:", - "translation": "这会生成如下错误:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEFILENAMEREPORTEDINTHEERRORMESSAGEMYCOMPONENTTSMYCOMPONENTHTMLISASYNTHETICFILEGENERATEDBYTHETEMPLATECOMPILERTHATHOLDSCONTENTSOFTHEMYCOMPONENTCLASSTEMPLATECOMPILERNEVERWRITESTHISFILETODISKTHELINEANDCOLUMNNUMBERSARERELATIVETOTHETEMPLATESTRINGINTHECOMPONENTANNOTATIONOFTHECLASSMYCOMPONENTINTHISCASEIFACOMPONENTUSESTEMPLATEURLINSTEADOFTEMPLATETHEERRORSAREREPORTEDINTHEHTMLFILEREFERENCEDBYTHETEMPLATEURLINSTEADOFASYNTHETICFILE", - "original": "The file name reported in the error message, `my.component.ts.MyComponent.html`, is a synthetic file\n generated by the template compiler that holds contents of the `MyComponent` class template.\n Compiler never writes this file to disk. The line and column numbers are relative to the template string\n in the `@Component` annotation of the class, `MyComponent` in this case. If a component uses\n `templateUrl` instead of `template`, the errors are reported in the HTML file referenced by the\n `templateUrl` instead of a synthetic file.", - "translation": "错误信息中汇报的文件名 `my.component.ts.MyComponent.html` 是一个由模板编译器生成出的虚拟文件,\n 用于保存 `MyComponent` 类的模板内容。\n 编译器永远不会把这个文件写入磁盘。这个例子中,这里的行号和列号都是相对于 `MyComponent` 的 `@Component` 注解中的模板字符串的。\n 如果组件使用 `templateUrl` 来代替 `template`,这些错误就会在 `templateUrl` 引用的 HTML 文件中汇报,而不是这个虚拟文件中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEERRORLOCATIONISTHEBEGINNINGOFTHETEXTNODETHATCONTAINSTHEINTERPOLATIONEXPRESSIONWITHTHEERRORIFTHEERRORISINANATTRIBUTEBINDINGSUCHASVALUEPERSONADDRESSSTREETTHEERRORLOCATIONISTHELOCATIONOFTHEATTRIBUTETHATCONTAINSTHEERROR", - "original": "The error location is the beginning of the text node that contains the interpolation expression with\n the error. If the error is in an attribute binding such as `[value]=\"person.address.street\"`, the error\n location is the location of the attribute that contains the error.", - "translation": "错误的位置是从包含出错的插值表达式的那个文本节点开始的。\n 如果错误是一个属性绑定,比如 `[value]=\"person.address.street\"` ,错误的位置就是那个包含错误的属性的位置。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEVALIDATIONUSESTHETYPESCRIPTTYPECHECKERANDTHEOPTIONSSUPPLIEDTOTHETYPESCRIPTCOMPILERTOCONTROLHOWDETAILEDTHETYPEVALIDATIONISFOREXAMPLEIFTHESTRICTTYPECHECKSISSPECIFIEDTHEERRORMYCOMPONENTTSMYCOMPONENTHTML11::OBJECTISPOSSIBLYUNDEFINEDISREPORTEDASWELLASTHEABOVEERRORMESSAGE", - "original": "The validation uses the TypeScript type checker and the options supplied to the TypeScript compiler to control\n how detailed the type validation is. For example, if the `strictTypeChecks` is specified, the error ```my.component.ts.MyComponent.html(1,1): : Object is possibly 'undefined'``` is reported as well as the above error message.", - "translation": "这个验证过程使用 TypeScript 的类型检查器,这些选项也会提供给 TypeScript 编译器以控制类型验证的详细程度。\n 比如,如果指定了 `strictTypeChecks`,就会像上面的错误信息一样报告 ```my.component.ts.MyComponent.html(1,1): : Object is possibly 'undefined'``` 错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###TYPENARROWING", - "original": "### Type narrowing", - "translation": "### 类型窄化", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THEEXPRESSIONUSEDINANNGIFDIRECTIVEISUSEDTONARROWTYPEUNIONSINTHEANGULARTEMPLATECOMPILERTHESAMEWAYTHEIFEXPRESSIONDOESINTYPESCRIPTFOREXAMPLETOAVOIDOBJECTISPOSSIBLYUNDEFINEDERRORINTHETEMPLATEABOVEMODIFYITTOONLYEMITTHEINTERPOLATIONIFTHEVALUEOFPERSONISINITIALIZEDASSHOWNBELOW:", - "original": "The expression used in an `ngIf` directive is used to narrow type unions in the Angular\n template compiler, the same way the `if` expression does in TypeScript. For example, to avoid\n `Object is possibly 'undefined'` error in the template above, modify it to only emit the\n interpolation if the value of `person` is initialized as shown below:", - "translation": "在 `ngIf` 指令中使用的表达式用来在 Angular 模板编译器中窄化联合类型,就像 TypeScript 中的 `if` 表达式一样。\n 比如,要在上述模板中消除 `Object is possibly 'undefined'` 错误,可以把它改成只在 `person` 的值初始化过的时候才生成这个插值表达式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "USINGNGIFALLOWSTHETYPESCRIPTCOMPILERTOINFERTHATTHEPERSONUSEDINTHEBINDINGEXPRESSIONWILLNEVERBEUNDEFINED", - "original": "Using `*ngIf` allows the TypeScript compiler to infer that the `person` used in the\n binding expression will never be `undefined`.", - "translation": "使用 `*ngIf` 能让 TypeScript 编译器推断出这个绑定表达式中使用的 `person` 永远不会是 `undefined`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "####CUSTOMNGIFLIKEDIRECTIVES", - "original": "#### Custom `ngIf` like directives", - "translation": "#### 类似于的 `ngIf` 的自定义指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "DIRECTIVESTHATBEHAVELIKENGIFCANDECLARETHATTHEYWANTTHESAMETREATMENTBYINCLUDINGASTATICMEMBERMARKERTHATISASIGNALTOTHETEMPLATECOMPILERTOTREATTHEMLIKENGIFTHISSTATICMEMBERFORNGIFIS:", - "original": "Directives that behave like `*ngIf` can declare that they want the same treatment by including\n a static member marker that is a signal to the template compiler to treat them\n like `*ngIf`. This static member for `*ngIf` is:", - "translation": "那些行为与 `*ngIf` 类似的指令可以通过包含一个静态成员作为标记,来告诉模板编译器它们希望和 `*ngIf` 享受同等待遇。这个 `*ngIf` 的静态成员就是:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THISDECLARESTHATTHEINPUTPROPERTYNGIFOFTHENGIFDIRECTIVESHOULDBETREATEDASAGUARDTOTHEUSEOFITSTEMPLATEIMPLYINGTHATTHETEMPLATEWILLONLYBEINSTANTIATEDIFTHENGIFINPUTPROPERTYISTRUE", - "original": "This declares that the input property `ngIf` of the `NgIf` directive should be treated as a\n guard to the use of its template, implying that the template will only be instantiated if\n the `ngIf` input property is true.", - "translation": "它声明了 `NgIf` 指令的 `ngIf` 属性应该在用到它的模板中看做一个守卫,以表明只有当 `ngIf` 这个输入属性为 `true` 时,才应该生成那个模板。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###NONNULLTYPEASSERTIONOPERATOR", - "original": "### Non-null type assertion operator", - "translation": "### 非空类型断言操作符", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "USETHENONNULLTYPEASSERTIONOPERATORGUIDETEMPLATESYNTAX#NONNULLASSERTIONOPERATORTOSUPPRESSTHEOBJECTISPOSSIBLYUNDEFINEDERRORWHENITISINCOVIENENTTOUSENGIFORWHENSOMECONSTRAINTINTHECOMPONENTENSURESTHATTHEEXPRESSIONISALWAYSNONNULLWHENTHEBINDINGEXPRESSIONISINTERPOLATED", - "original": "Use the [non-null type assertion operator](guide/template-syntax#non-null-assertion-operator)\n to suppress the `Object is possibly 'undefined'` error when it is incovienent to use\n `*ngIf` or when some constraint in the component ensures that the expression is always\n non-null when the binding expression is interpolated.", - "translation": "使用 [非空类型断言操作符](guide/template-syntax#non-null-assertion-operator)可以在不方便使用 `*ngIf` 或\n 当组件中的某些约束可以确保这个绑定表达式在求值时永远不会为空时,防止出现 `Object is possibly 'undefined'` 错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "INTHEFOLLOWINGEXAMPLETHEPERSONANDADDRESSPROPERTIESAREALWAYSSETTOGETHERIMPLYINGTHATADDRESSISALWAYSNONNULLIFPERSONISNONNULLTHEREISNOCONVENIENTWAYTODESCRIBETHISCONSTRAINTTOTYPESCRIPTANDTHETEMPLATECOMPILERBUTTHEERRORISSUPPRESSEDINTHEEXAMPLEBYUSINGADDRESSSTREET", - "original": "In the following example, the `person` and `address` properties are always set together,\n implying that `address` is always non-null if `person` is non-null. There is no convenient\n way to describe this constraint to TypeScript and the template compiler, but the error\n is suppressed in the example by using `address!.street`.", - "translation": "在下列例子中,`person` 和 `address` 属性总是一起出现的,如果 `person` 非空,则 `address` 也一定非空。没有一种简便的写法可以向 TypeScript 和模板编译器描述这种约束。但是这个例子中使用 `address!.street` 避免了报错。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "THENONNULLASSERTIONOPERATORSHOULDBEUSEDSPARINGLYASREFACTORINGOFTHECOMPONENTMIGHTBREAKTHISCONSTRAINT", - "original": "The non-null assertion operator should be used sparingly as refactoring of the component\n might break this constraint.", - "translation": "应该保守点使用非空断言操作符,因为将来对组件的重构可能会破坏这个约束。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "INTHISEXAMPLEITISRECOMMENDEDTOINCLUDETHECHECKINGOFADDRESSINTHENGIFASSHOWNBELOW:", - "original": "In this example it is recommended to include the checking of `address`\n in the `*ngIf`as shown below:", - "translation": "这个例子中,更建议在 `*ngIf` 中包含对 `address` 的检查,代码如下:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "###DISABLINGTYPECHECKINGUSINGANY", - "original": "### Disabling type checking using `$any()`", - "translation": "### 使用 `$any()` 禁用类型检查", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "DISABLECHECKINGOFABINDINGEXPRESSIONBYSURROUNDINGTHEEXPRESSIONINACALLTOTHEANYCASTPSEUDOFUNCTIONGUIDETEMPLATESYNTAXTHECOMPILERTREATSITASACASTTOTHEANYTYPEJUSTLIKEINTYPESCRIPTWHENAANYORASANYCASTISUSED", - "original": "Disable checking of a binding expression by surrounding the expression\n in a call to the [`$any()` cast pseudo-function](guide/template-syntax).\n The compiler treats it as a cast to the `any` type just like in TypeScript when a ``\n or `as any` cast is used.", - "translation": "可以通过把绑定表达式包含在[类型转换伪函数 `$any()` ](guide/template-syntax) 中来禁用类型检查。\n 编译器会像在 TypeScript 中使用 `` 或 `as any` 进行类型转换一样对待它。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "INTHEFOLLOWINGEXAMPLETHEERRORPROPERTYADDRESSSDOESNOTEXISTISSUPPRESSEDBYCASTINGPERSONTOTHEANYTYPE", - "original": "In the following example, the error `Property addresss does not exist` is suppressed\n by casting `person` to the `any` type.", - "translation": "下面的例子中,通过把 `person` 转换成 `any` 类型,忽略了 `Property addresss does not exist` 错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "##SUMMARY", - "original": "## Summary", - "translation": "## 小结", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "WHATTHEAOTCOMPILERDOESANDWHYITISIMPORTANT", - "original": "* What the AOT compiler does and why it is important.", - "translation": "什么是 AOT 编译器,以及它为什么如此重要。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "WHYMETADATAMUSTBEWRITTENINASUBSETOFJAVASCRIPT", - "original": "* Why metadata must be written in a subset of JavaScript.", - "translation": "为何元数据必须使用 JavaScript 的一个子集来书写。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "WHATTHATSUBSETIS", - "original": "* What that subset is.", - "translation": "这个子集是什么。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "OTHERRESTRICTIONSONMETADATADEFINITION", - "original": "* Other restrictions on metadata definition.", - "translation": "定义元数据时的其它限制。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "MACROFUNCTIONSANDMACROSTATICMETHODS", - "original": "* Macro-functions and macro-static methods.", - "translation": "宏函数和静态宏函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "COMPILERERRORSRELATEDTOMETADATA", - "original": "* Compiler errors related to metadata.", - "translation": "与元数据有关的编译器错误。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "VALIDATIONOFBINDINGEXPRESSIONS", - "original": "* Validation of binding expressions", - "translation": "验证绑定表达式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" - }, - { - "key": "PROPERTY", - "original": "Property", - "translation": "属性", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/api-page-class.md" - }, - { - "key": "TYPE", - "original": "Type", - "translation": "绑定类型", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/api-page-class.md" - }, - { - "key": "DESCRIPTION", - "original": "Description", - "translation": "说明", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/api-page-class.md" - }, - { - "key": "TYPE", - "original": "Type", - "translation": "绑定类型", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/api-page-class.md" - }, - { - "key": "TYPE", - "original": "Type", - "translation": "绑定类型", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/api-page-class.md" - }, - { - "key": "#INTRODUCTIONTOCOMPONENTS", - "original": "# Introduction to components", - "translation": "# 组件简介", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ACOMPONENTCONTROLSAPATCHOFSCREENCALLEDAVIEWFOREXAMPLEINDIVIDUALCOMPONENTSDEFINEANDCONTROLEACHOFTHEFOLLOWINGVIEWSFROMTHETUTORIALTUTORIALINDEX:", - "original": "A _component_ controls a patch of screen called a *view*. For example, individual components define and control each of the following views from the [Tutorial](tutorial/index):", - "translation": "*组件*控制屏幕上被称为*视图*的一小片区域。比如,[教程](tutorial/index)中的下列视图都是由一个个组件所定义和控制的:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THEAPPROOTWITHTHENAVIGATIONLINKS", - "original": "* The app root with the navigation links.", - "translation": "带有导航链接的应用根组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THELISTOFHEROES", - "original": "* The list of heroes.", - "translation": "英雄列表。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THEHEROEDITOR", - "original": "* The hero editor.", - "translation": "英雄编辑器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "YOUDEFINEACOMPONENTSAPPLICATIONLOGICMDASHWHATITDOESTOSUPPORTTHEVIEWMDASHINSIDEACLASSTHECLASSINTERACTSWITHTHEVIEWTHROUGHANAPIOFPROPERTIESANDMETHODS", - "original": "You define a component's application logic—what it does to support the view—inside a class. The class interacts with the view through an API of properties and methods.", - "translation": "你在类中定义组件的应用逻辑,为视图提供支持。\n组件通过一些由属性和方法组成的 API 与视图交互。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "FOREXAMPLETHEHEROLISTCOMPONENTHASAHEROESPROPERTYTHATRETURNSANARRAYOFHEROESTHATITACQUIRESFROMASERVICEHEROLISTCOMPONENTALSOHASASELECTHEROMETHODTHATSETSASELECTEDHEROPROPERTYWHENTHEUSERCLICKSTOCHOOSEAHEROFROMTHATLIST", - "original": "For example, the `HeroListComponent` has a `heroes` property that returns an array of heroes that it acquires from a service. `HeroListComponent` also has a `selectHero()` method that sets a `selectedHero` property when the user clicks to choose a hero from that list.", - "translation": "比如,`HeroListComponent` 有一个 `heroes` 属性,它会返回一个从服务中取到的英雄数组。\n`HeroListComponent` 还有一个 `selectHero()` 方法,当用户从列表中选择一个英雄时,它会设置 `selectedHero` 属性的值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ANGULARCREATESUPDATESANDDESTROYSCOMPONENTSASTHEUSERMOVESTHROUGHTHEAPPLICATIONYOURAPPCANTAKEACTIONATEACHMOMENTINTHISLIFECYCLETHROUGHOPTIONALLIFECYCLEHOOKSGUIDELIFECYCLEHOOKSLIKENGONINIT", - "original": "Angular creates, updates, and destroys components as the user moves through the application. Your app can take action at each moment in this lifecycle through optional [lifecycle hooks](guide/lifecycle-hooks), like `ngOnInit()`.", - "translation": "当用户在应用中穿行时,Angular 就会创建、更新、销毁一些组件。\n你的应用可以通过一些可选的[生命周期钩子](guide/lifecycle-hooks)(比如`ngOnInit()`)来在每个特定的时机采取行动。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "##COMPONENTMETADATA", - "original": "## Component metadata", - "translation": "## 组件的元数据", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THECOMPONENTDECORATORIDENTIFIESTHECLASSIMMEDIATELYBELOWITASACOMPONENTCLASSANDSPECIFIESITSMETADATAINTHEEXAMPLECODEBELOWYOUCANSEETHATHEROLISTCOMPONENTISJUSTACLASSWITHNOSPECIALANGULARNOTATIONORSYNTAXATALLITSNOTACOMPONENTUNTILYOUMARKITASONEWITHTHECOMPONENTDECORATOR", - "original": "The `@Component` decorator identifies the class immediately below it as a component class, and specifies its metadata. In the example code below, you can see that `HeroListComponent` is just a class, with no special Angular notation or syntax at all. It's not a component until you mark it as one with the `@Component` decorator.", - "translation": "`@Component` 装饰器会指出紧随其后的那个类是个组件类,并为其指定元数据。\n在下面的范例代码中,你可以看到 `HeroListComponent` 只是一个普通类,完全没有 Angular 特有的标记或语法。\n直到给它加上了 `@Component` 装饰器,它才变成了组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THEMETADATAFORACOMPONENTTELLSANGULARWHERETOGETTHEMAJORBUILDINGBLOCKSITNEEDSTOCREATEANDPRESENTTHECOMPONENTANDITSVIEWINPARTICULARITASSOCIATESATEMPLATEWITHTHECOMPONENTEITHERDIRECTLYWITHINLINECODEORBYREFERENCETOGETHERTHECOMPONENTANDITSTEMPLATEDESCRIBEAVIEW", - "original": "The metadata for a component tells Angular where to get the major building blocks it needs to create and present the component and its view. In particular, it associates a _template_ with the component, either directly with inline code, or by reference. Together, the component and its template describe a _view_.", - "translation": "组件的元数据告诉 Angular 到哪里获取它需要的主要构造块,以创建和展示这个组件及其视图。\n具体来说,它把一个*模板*(无论是直接内联在代码中还是引用的外部文件)和该组件关联起来。\n该组件及其模板,共同描述了一个*视图*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "INADDITIONTOCONTAININGORPOINTINGTOTHETEMPLATETHECOMPONENTMETADATACONFIGURESFOREXAMPLEHOWTHECOMPONENTCANBEREFERENCEDINHTMLANDWHATSERVICESITREQUIRES", - "original": "In addition to containing or pointing to the template, the `@Component` metadata configures, for example, how the component can be referenced in HTML and what services it requires.", - "translation": "除了包含或指向模板之外,`@Component` 的元数据还会配置要如何在 HTML 中引用该组件,以及该组件需要哪些服务等等。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "HERESANEXAMPLEOFBASICMETADATAFORHEROLISTCOMPONENT:", - "original": "Here's an example of basic metadata for `HeroListComponent`:", - "translation": "下面的例子中就是 `HeroListComponent` 的基础元数据:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THISEXAMPLESHOWSSOMEOFTHEMOSTUSEFULCOMPONENTCONFIGURATIONOPTIONS:", - "original": "This example shows some of the most useful `@Component` configuration options:", - "translation": "这个例子展示了一些最常用的 `@Component` 配置选项:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "SELECTOR:ACSSSELECTORTHATTELLSANGULARTOCREATEANDINSERTANINSTANCEOFTHISCOMPONENTWHEREVERITFINDSTHECORRESPONDINGTAGINTEMPLATEHTMLFOREXAMPLEIFANAPPSHTMLCONTAINSAPPHEROLISTAPPHEROLISTTHENANGULARINSERTSANINSTANCEOFTHEHEROLISTCOMPONENTVIEWBETWEENTHOSETAGS", - "original": "* `selector`: A CSS selector that tells Angular to create and insert an instance of this component wherever it finds the corresponding tag in template HTML. For example, if an app's HTML contains ``, then\nAngular inserts an instance of the `HeroListComponent` view between those tags.", - "translation": "`selector`:是一个 CSS 选择器,它会告诉 Angular,一旦在模板 HTML 中找到了这个选择器对应的标签,就创建并插入该组件的一个实例。\n 比如,如果应用的 HTML 中包含 ``,Angular 就会在这些标签中插入一个 `HeroListComponent` 实例的视图。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "TEMPLATEURL:THEMODULERELATIVEADDRESSOFTHISCOMPONENTSHTMLTEMPLATEALTERNATIVELYYOUCANPROVIDETHEHTMLTEMPLATEINLINEASTHEVALUEOFTHETEMPLATEPROPERTYTHISTEMPLATEDEFINESTHECOMPONENTSHOSTVIEW", - "original": "* `templateUrl`: The module-relative address of this component's HTML template. Alternatively, you can provide the HTML template inline, as the value of the `template` property. This template defines the component's _host view_.", - "translation": "`templateUrl`:该组件的 HTML 模板文件相对于这个组件文件的地址。\n 另外,你还可以用 `template` 属性的值来提供内联的 HTML 模板。\n 这个模板定义了该组件的*宿主视图*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "PROVIDERS:ANARRAYOFDEPENDENCYINJECTIONPROVIDERSFORSERVICESTHATTHECOMPONENTREQUIRESINTHEEXAMPLETHISTELLSANGULARTHATTHECOMPONENTSCONSTRUCTORREQUIRESAHEROSERVICEINSTANCEINORDERTOGETTHELISTOFHEROESTODISPLAY", - "original": "* `providers`: An array of **dependency injection providers** for services that the component requires. In the example, this tells Angular that the component's constructor requires a `HeroService` instance\nin order to get the list of heroes to display.", - "translation": "`providers` 是当前组件所需的**依赖注入提供商**的一个数组。在这个例子中,它告诉 Angular,该组件的构造函数需要一个 `HeroService` 实例,以获取要显示的英雄列表。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "##TEMPLATESANDVIEWS", - "original": "## Templates and views", - "translation": "## 模板与视图", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "YOUDEFINEACOMPONENTSVIEWWITHITSCOMPANIONTEMPLATEATEMPLATEISAFORMOFHTMLTHATTELLSANGULARHOWTORENDERTHECOMPONENT", - "original": "You define a component's view with its companion template. A template is a form of HTML that tells Angular how to render the component.", - "translation": "你要通过组件的配套模板来定义其视图。模板就是一种 HTML,它会告诉 Angular 如何渲染该组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "VIEWSARETYPICALLYARRANGEDHIERARCHICALLYALLOWINGYOUTOMODIFYORSHOWANDHIDEENTIREUISECTIONSORPAGESASAUNITTHETEMPLATEIMMEDIATELYASSOCIATEDWITHACOMPONENTDEFINESTHATCOMPONENTSHOSTVIEWTHECOMPONENTCANALSODEFINEAVIEWHIERARCHYWHICHCONTAINSEMBEDDEDVIEWSHOSTEDBYOTHERCOMPONENTS", - "original": "Views are typically arranged hierarchically, allowing you to modify or show and hide entire UI sections or pages as a unit. The template immediately associated with a component defines that component's _host view_. The component can also define a _view hierarchy_, which contains _embedded views_, hosted by other components.", - "translation": "视图通常会分层次进行组织,让你能以 UI 分区或页面为单位进行修改、显示或隐藏。\n与组件直接关联的模板会定义该组件的*宿主视图*。该组件还可以定义一个*带层次结构的视图*,它包含一些*内嵌的视图*作为其它组件的宿主。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "AVIEWHIERARCHYCANINCLUDEVIEWSFROMCOMPONENTSINTHESAMENGMODULEBUTITALSOCANANDOFTENDOESINCLUDEVIEWSFROMCOMPONENTSTHATAREDEFINEDINDIFFERENTNGMODULES", - "original": "A view hierarchy can include views from components in the same NgModule, but it also can (and often does) include views from components that are defined in different NgModules.", - "translation": "带层次结构的视图可以包含同一模块(NgModule)中组件的视图,也可以(而且经常会)包含其它模块中定义的组件的视图。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "##TEMPLATESYNTAX", - "original": "## Template syntax", - "translation": "## 模板语法", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ATEMPLATELOOKSLIKEREGULARHTMLEXCEPTTHATITALSOCONTAINSANGULARTEMPLATESYNTAXGUIDETEMPLATESYNTAXWHICHALTERSTHEHTMLBASEDONYOURAPPSLOGICANDTHESTATEOFAPPANDDOMDATAYOURTEMPLATECANUSEDATABINDINGTOCOORDINATETHEAPPANDDOMDATAPIPESTOTRANSFORMDATABEFOREITISDISPLAYEDANDDIRECTIVESTOAPPLYAPPLOGICTOWHATGETSDISPLAYED", - "original": "A template looks like regular HTML, except that it also contains Angular [template syntax](guide/template-syntax), which alters the HTML based on your app's logic and the state of app and DOM data. Your template can use _data binding_ to coordinate the app and DOM data, _pipes_ to transform data before it is displayed, and _directives_ to apply app logic to what gets displayed.", - "translation": "模板很像标准的 HTML,但是它还包含 Angular 的[模板语法](guide/template-syntax),这些模板语法可以根据你的应用逻辑、应用状态和 DOM 数据来修改这些 HTML。\n你的模板可以使用*数据绑定*来协调应用和 DOM 中的数据,使用*管道*在显示出来之前对其进行转换,使用*指令*来把程序逻辑应用到要显示的内容上。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "FOREXAMPLEHEREISATEMPLATEFORTHETUTORIALSHEROLISTCOMPONENT:", - "original": "For example, here is a template for the Tutorial's `HeroListComponent`:", - "translation": "比如,下面是本教程中 `HeroListComponent` 的模板:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THISTEMPLATEUSESTYPICALHTMLELEMENTSLIKEH2ANDPANDALSOINCLUDESANGULARTEMPLATESYNTAXELEMENTSNGFORHERONAMECLICKHEROANDAPPHERODETAILTHETEMPLATESYNTAXELEMENTSTELLANGULARHOWTORENDERTHEHTMLTOTHESCREENUSINGPROGRAMLOGICANDDATA", - "original": "This template uses typical HTML elements like `

` and `

`, and also includes Angular template-syntax elements, `*ngFor`, `{{hero.name}}`, `(click)`, `[hero]`, and ``. The template-syntax elements tell Angular how to render the HTML to the screen, using program logic and data.", - "translation": "这个模板使用了典型的 HTML 元素,比如 `

` 和 `

`,还包括一些 Angular 的模板语法元素,如 `*ngFor`,`{{hero.name}}`,`click`、`[hero]` 和 ``。这些模板语法元素告诉 Angular 该如何根据程序逻辑和数据在屏幕上渲染 HTML。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THENGFORDIRECTIVETELLSANGULARTOITERATEOVERALIST", - "original": "* The `*ngFor` directive tells Angular to iterate over a list.", - "translation": "`*ngFor` 指令告诉 Angular 在一个列表上进行迭代。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THEHERONAMECLICKANDHEROBINDPROGRAMDATATOANDFROMTHEDOMRESPONDINGTOUSERINPUTSEEMOREABOUTDATABINDING#DATABINDINGBELOW", - "original": "* The `{{hero.name}}`, `(click)`, and `[hero]` bind program data to and from the DOM, responding to user input. See more about [data binding](#data-binding) below.", - "translation": "`{{hero.name}}`、`(click)` 和 `[hero]` 把程序数据绑定到及绑定回 DOM,以响应用户的输入。更多内容参见稍后的[数据绑定](#data-binding)部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THEAPPHERODETAILTAGINTHEEXAMPLEISANELEMENTTHATREPRESENTSANEWCOMPONENTHERODETAILCOMPONENTTHEHERODETAILCOMPONENTCODENOTSHOWNISACHILDCOMPONENTOFTHEHEROLISTCOMPONENTTHATDEFINESTHEHERODETAILVIEWNOTICEHOWCUSTOMCOMPONENTSLIKETHISMIXSEAMLESSLYWITHNATIVEHTMLINTHESAMELAYOUTS", - "original": "* The `` tag in the example is an element that represents a new component, `HeroDetailComponent`. The `HeroDetailComponent` (code not shown) is a child component of the `HeroListComponent` that defines the Hero-detail view. Notice how custom components like this mix seamlessly with native HTML in the same layouts.", - "translation": "模板中的 `` 标签是一个代表新组件 `HeroDetailComponent` 的元素。\n `HeroDetailComponent`(代码略)是 `HeroListComponent` 的一个子组件,它定义了英雄详情视图。\n 注意观察像这样的自定义组件是如何与原生 HTML 元素无缝的混合在一起的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "###DATABINDING", - "original": "### Data binding", - "translation": "### 数据绑定", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "WITHOUTAFRAMEWORKYOUWOULDBERESPONSIBLEFORPUSHINGDATAVALUESINTOTHEHTMLCONTROLSANDTURNINGUSERRESPONSESINTOACTIONSANDVALUEUPDATESWRITINGSUCHPUSHPULLLOGICBYHANDISTEDIOUSERRORPRONEANDANIGHTMARETOREADASANYEXPERIENCEDJQUERYPROGRAMMERCANATTEST", - "original": "Without a framework, you would be responsible for pushing data values into the HTML controls and turning user responses into actions and value updates. Writing such push/pull logic by hand is tedious, error-prone, and a nightmare to read, as any experienced jQuery programmer can attest.", - "translation": "如果没有框架,你就要自己负责把数据值推送到 HTML 控件中,并把来自用户的响应转换成动作和对值的更新。\n手动写这种数据推拉逻辑会很枯燥、容易出错,难以阅读 —— 用过 jQuery 的程序员一定深有体会。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ANGULARSUPPORTSTWOWAYDATABINDINGAMECHANISMFORCOORDINATINGPARTSOFATEMPLATEWITHPARTSOFACOMPONENTADDBINDINGMARKUPTOTHETEMPLATEHTMLTOTELLANGULARHOWTOCONNECTBOTHSIDES", - "original": "Angular supports *two-way data binding*, a mechanism for coordinating parts of a template with parts of a component. Add binding markup to the template HTML to tell Angular how to connect both sides.", - "translation": "Angular 支持*双向数据绑定*,这是一种对模板中的各个部件与组件中的各个部件进行协调的机制。\n往模板 HTML 中添加绑定标记可以告诉 Angular 该如何连接它们。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THEFOLLOWINGDIAGRAMSHOWSTHEFOURFORMSOFDATABINDINGMARKUPEACHFORMHASADIRECTIONMDASHTOTHEDOMFROMTHEDOMORINBOTHDIRECTIONS", - "original": "The following diagram shows the four forms of data binding markup. Each form has a direction—to the DOM, from the DOM, or in both directions.", - "translation": "下图显示了数据绑定标记的四种形式。每种形式都有一个方向 —— 从组件到 DOM、从 DOM 到组件或双向。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THISEXAMPLEFROMTHEHEROLISTCOMPONENTTEMPLATEUSESTHREEOFTHESEFORMS:", - "original": "This example from the `HeroListComponent` template uses three of these forms:", - "translation": "这个来自 `HeroListComponent` 模板中的例子使用了其中的三种形式:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THEHERONAMEINTERPOLATIONGUIDEDISPLAYINGDATA#INTERPOLATIONDISPLAYSTHECOMPONENTSHERONAMEPROPERTYVALUEWITHINTHELIELEMENT", - "original": "* The `{{hero.name}}` [*interpolation*](guide/displaying-data#interpolation)\ndisplays the component's `hero.name` property value within the `

  • ` element.", - "translation": "`{{hero.name}}`[*插值表达式*](guide/displaying-data#interpolation)在 `
  • ` 标签中显示组件的 `hero.name` 属性的值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THEHEROPROPERTYBINDINGGUIDETEMPLATESYNTAX#PROPERTYBINDINGPASSESTHEVALUEOFSELECTEDHEROFROMTHEPARENTHEROLISTCOMPONENTTOTHEHEROPROPERTYOFTHECHILDHERODETAILCOMPONENT", - "original": "* The `[hero]` [*property binding*](guide/template-syntax#property-binding) passes the value of `selectedHero` from\nthe parent `HeroListComponent` to the `hero` property of the child `HeroDetailComponent`.", - "translation": "`[hero]`[*属性绑定*](guide/template-syntax#property-binding)把父组件 `HeroListComponent` 的 `selectedHero` 的值传到子组件 `HeroDetailComponent` 的 `hero` 属性中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THECLICKEVENTBINDINGGUIDEUSERINPUT#BINDINGTOUSERINPUTEVENTSCALLSTHECOMPONENTSSELECTHEROMETHODWHENTHEUSERCLICKSAHEROSNAME", - "original": "* The `(click)` [*event binding*](guide/user-input#binding-to-user-input-events) calls the component's `selectHero` method when the user clicks a hero's name.", - "translation": "当用户点击某个英雄的名字时,`(click)` [*事件绑定*](guide/user-input#binding-to-user-input-events)会调用组件的 `selectHero` 方法。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "TWOWAYDATABINDINGISANIMPORTANTFOURTHFORMTHATCOMBINESPROPERTYANDEVENTBINDINGINASINGLENOTATIONHERESANEXAMPLEFROMTHEHERODETAILCOMPONENTTEMPLATETHATUSESTWOWAYDATABINDINGWITHTHENGMODELDIRECTIVE:", - "original": "**Two-way data binding** is an important fourth form that combines property and event binding in a single notation. Here's an example from the `HeroDetailComponent` template that uses two-way data binding with the `ngModel` directive:", - "translation": "第四种重要的绑定形式是**双向数据绑定**,它把属性绑定和事件绑定组合成一种单独的写法。下面这个来自 `HeroDetailComponent` 模板中的例子通过 `ngModel` 指令使用了双向数据绑定:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "INTWOWAYBINDINGADATAPROPERTYVALUEFLOWSTOTHEINPUTBOXFROMTHECOMPONENTASWITHPROPERTYBINDINGTHEUSERSCHANGESALSOFLOWBACKTOTHECOMPONENTRESETTINGTHEPROPERTYTOTHELATESTVALUEASWITHEVENTBINDING", - "original": "In two-way binding, a data property value flows to the input box from the component as with property binding.\nThe user's changes also flow back to the component, resetting the property to the latest value,\nas with event binding.", - "translation": "在双向绑定中,数据属性值通过属性绑定从组件流到输入框。用户的修改通过事件绑定流回组件,把属性值设置为最新的值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ANGULARPROCESSESALLDATABINDINGSONCEPERJAVASCRIPTEVENTCYCLEFROMTHEROOTOFTHEAPPLICATIONCOMPONENTTREETHROUGHALLCHILDCOMPONENTS", - "original": "Angular processes *all* data bindings once per JavaScript event cycle,\nfrom the root of the application component tree through all child components.", - "translation": "Angular 在每个 JavaScript 事件循环中处理*所有的*数据绑定,它会从组件树的根部开始,递归处理全部子组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "DATABINDINGPLAYSANIMPORTANTROLEINCOMMUNICATIONBETWEENATEMPLATEANDITSCOMPONENTANDISALSOIMPORTANTFORCOMMUNICATIONBETWEENPARENTANDCHILDCOMPONENTS", - "original": "Data binding plays an important role in communication between a template and its component, and is also important for communication between parent and child components.", - "translation": "数据绑定在模板及其组件之间的通讯中扮演了非常重要的角色,它对于父组件和子组件之间的通讯也同样重要。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "###PIPES", - "original": "### Pipes", - "translation": "### 管道", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ANGULARPIPESLETYOUDECLAREDISPLAYVALUETRANSFORMATIONSINYOURTEMPLATEHTMLACLASSWITHTHEPIPEDECORATORDEFINESAFUNCTIONTHATTRANSFORMSINPUTVALUESTOOUTPUTVALUESFORDISPLAYINAVIEW", - "original": "Angular pipes let you declare display-value transformations in your template HTML. A class with the `@Pipe` decorator defines a function that transforms input values to output values for display in a view.", - "translation": "Angular 的管道可以让你在模板中声明显示值的转换逻辑。\n 带有 `@Pipe` 装饰器的类中会定义一个转换函数,用来把输入值转换成供视图显示用的输出值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ANGULARDEFINESVARIOUSPIPESSUCHASTHEDATEHTTPS:ANGULARIOAPICOMMONDATEPIPEPIPEANDCURRENCYHTTPS:ANGULARIOAPICOMMONCURRENCYPIPEPIPEFORACOMPLETELISTSEETHEPIPESAPILISTHTTPS:ANGULARIOAPITYPEPIPEYOUCANALSODEFINENEWPIPES", - "original": "Angular defines various pipes, such as the [date](https://angular.io/api/common/DatePipe) pipe and [currency](https://angular.io/api/common/CurrencyPipe) pipe; for a complete list, see the [Pipes API list](https://angular.io/api?type=pipe). You can also define new pipes.", - "translation": "Angular 自带了很多管道,比如 [date](https://angular.cn/api/common/DatePipe) 管道和 [currency](https://angular.cno/api/common/CurrencyPipe) 管道,完整的列表参见 [Pipes API 列表](https://angular.cn/api?type=pipe)。你也可以自己定义一些新管道。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "TOSPECIFYAVALUETRANSFORMATIONINANHTMLTEMPLATEUSETHEPIPEOPERATORHTTPS:ANGULARIOGUIDETEMPLATESYNTAX#PIPE:", - "original": "To specify a value transformation in an HTML template, use the [pipe operator (|)](https://angular.io/guide/template-syntax#pipe):", - "translation": "要在 HTML 模板中指定值的转换方式,请使用 [管道操作符 (|)](https://angular.cn/guide/template-syntax#pipe)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "YOUCANCHAINPIPESSENDINGTHEOUTPUTOFONEPIPEFUNCTIONTOBETRANSFORMEDBYANOTHERPIPEFUNCTIONAPIPECANALSOTAKEARGUMENTSTHATCONTROLHOWITPERFORMSITSTRANSFORMATIONFOREXAMPLEYOUCANPASSTHEDESIREDFORMATTOTHEDATEPIPE:", - "original": "You can chain pipes, sending the output of one pipe function to be transformed by another pipe function. A pipe can also take arguments that control how it performs its transformation. For example, you can pass the desired format to the `date` pipe:", - "translation": "你可以把管道串联起来,把一个管道函数的输出送给另一个管道函数进行转换。\n 管道还能接收一些参数,来控制它该如何进行转换。比如,你可以把要使用的日期格式传给 `date` 管道:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "###DIRECTIVES", - "original": "### Directives", - "translation": "### 指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ANGULARTEMPLATESAREDYNAMICWHENANGULARRENDERSTHEMITTRANSFORMSTHEDOMACCORDINGTOTHEINSTRUCTIONSGIVENBYDIRECTIVESADIRECTIVEISACLASSWITHADIRECTIVEDECORATOR", - "original": "Angular templates are *dynamic*. When Angular renders them, it transforms the DOM according to the instructions given by *directives*. A directive is a class with a `@Directive` decorator.", - "translation": "Angular 的模板是*动态的*。当 Angular 渲染它们的时候,会根据*指令*给出的指示对 DOM 进行转换。\n指令就是一个带有 `@Directive` 装饰器的类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ACOMPONENTISTECHNICALLYADIRECTIVEBUTCOMPONENTSARESODISTINCTIVEANDCENTRALTOANGULARAPPLICATIONSTHATANGULARDEFINESTHECOMPONENTDECORATORWHICHEXTENDSTHEDIRECTIVEDECORATORWITHTEMPLATEORIENTEDFEATURES", - "original": "A component is technically a directive - but components are so distinctive and central to Angular applications that Angular defines the `@Component` decorator, which extends the `@Directive` decorator with template-oriented features.", - "translation": "组件从技术角度上说就是一个指令,但是由于组件对 Angular 应用来说非常独特、非常重要,因此 Angular 专门定义了 `@Component` 装饰器,它使用一些面向模板的特性扩展了 `@Directive` 装饰器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THEREARETWOKINDSOFDIRECTIVESBESIDESCOMPONENTS:STRUCTURALANDATTRIBUTEDIRECTIVESJUSTASFORCOMPONENTSTHEMETADATAFORADIRECTIVEASSOCIATESTHECLASSWITHASELECTORTHATYOUUSETOINSERTITINTOHTMLINTEMPLATESDIRECTIVESTYPICALLYAPPEARWITHINANELEMENTTAGASATTRIBUTESEITHERBYNAMEORASTHETARGETOFANASSIGNMENTORABINDING", - "original": "There are two kinds of directives besides components: _structural_ and _attribute_ directives. Just as for components, the metadata for a directive associates the class with a `selector` that you use to insert it into HTML. In templates, directives typically appear within an element tag as attributes, either by name or as the target of an assignment or a binding.", - "translation": "除组件外,还有两种指令:*结构型指令*和*属性型指令*。和组件一样,指令的元数据把指令类和一个 `selector` 关联起来,`selector` 用来把该指令插入到 HTML 中。\n在模板中,指令通常作为属性出现在元素标签上,可能仅仅作为名字出现,也可能作为赋值目标或绑定目标出现。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "####STRUCTURALDIRECTIVES", - "original": "#### Structural directives", - "translation": "#### 结构型指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "STRUCTURALDIRECTIVESALTERLAYOUTBYADDINGREMOVINGANDREPLACINGELEMENTSINDOMTHEEXAMPLETEMPLATEUSESTWOBUILTINSTRUCTURALDIRECTIVESTOADDAPPLICATIONLOGICTOHOWTHEVIEWISRENDERED:", - "original": "Structural directives alter layout by adding, removing, and replacing elements in DOM. The example template uses two built-in structural directives to add application logic to how the view is rendered:", - "translation": "结构型指令通过添加、移除或替换 DOM 元素来修改布局。\n这个范例模板使用了两个内置的结构型指令来为要渲染的视图添加程序逻辑:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "NGFORGUIDEDISPLAYINGDATA#NGFORISANITERATIVEITTELLSANGULARTOSTAMPOUTONELIPERHEROINTHEHEROESLIST", - "original": "* [`*ngFor`](guide/displaying-data#ngFor) is an iterative; it tells Angular to stamp out one `
  • ` per hero in the `heroes` list.", - "translation": "[`*ngFor`](guide/displaying-data#ngFor) 是一个迭代器,它要求 Angular 为 `heroes` 列表中的每个 `
  • ` 渲染出一个 `
  • `。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "NGIFGUIDEDISPLAYINGDATA#NGIFISACONDITIONALITINCLUDESTHEHERODETAILCOMPONENTONLYIFASELECTEDHEROEXISTS", - "original": "* [`*ngIf`](guide/displaying-data#ngIf) is a conditional; it includes the `HeroDetail` component only if a selected hero exists.", - "translation": "[`*ngIf`](guide/displaying-data#ngIf) 是个条件语句,只有当选中的英雄存在时,它才会包含 `HeroDetail` 组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "####ATTRIBUTEDIRECTIVES", - "original": "#### Attribute directives", - "translation": "#### 属性型指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ATTRIBUTEDIRECTIVESALTERTHEAPPEARANCEORBEHAVIOROFANEXISTINGELEMENTINTEMPLATESTHEYLOOKLIKEREGULARHTMLATTRIBUTESHENCETHENAME", - "original": "Attribute directives alter the appearance or behavior of an existing element.\nIn templates they look like regular HTML attributes, hence the name.", - "translation": "属性型指令会修改现有元素的外观或行为。\n在模板中,它们看起来就像普通的 HTML 属性一样,因此得名“属性型指令”。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "THENGMODELDIRECTIVEWHICHIMPLEMENTSTWOWAYDATABINDINGISANEXAMPLEOFANATTRIBUTEDIRECTIVENGMODELMODIFIESTHEBEHAVIOROFANEXISTINGELEMENTTYPICALLYANINPUTBYSETTINGITSDISPLAYVALUEPROPERTYANDRESPONDINGTOCHANGEEVENTS", - "original": "The `ngModel` directive, which implements two-way data binding, is an example of an attribute directive. `ngModel` modifies the behavior of an existing element (typically an ``) by setting its display value property and responding to change events.", - "translation": "`ngModel` 指令就是属性型指令的一个例子,它实现了双向数据绑定。\n`ngModel` 修改现有元素(一般是 ``)的行为:设置其显示属性值,并响应 change 事件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "ANGULARHASMOREPREDEFINEDDIRECTIVESTHATEITHERALTERTHELAYOUTSTRUCTUREFOREXAMPLENGSWITCHGUIDETEMPLATESYNTAX#NGSWITCHORMODIFYASPECTSOFDOMELEMENTSANDCOMPONENTSFOREXAMPLENGSTYLEGUIDETEMPLATESYNTAX#NGSTYLEANDNGCLASSGUIDETEMPLATESYNTAX#NGCLASS", - "original": "Angular has more pre-defined directives that either alter the layout structure\n(for example, [ngSwitch](guide/template-syntax#ngSwitch))\nor modify aspects of DOM elements and components\n(for example, [ngStyle](guide/template-syntax#ngStyle) and [ngClass](guide/template-syntax#ngClass)).", - "translation": "Angular 还有很多预定义指令,它们或者修改布局结构(比如 [ngSwitch](guide/template-syntax#ngSwitch)),或者修改 DOM 元素和组件的某些方面(比如 [ngStyle](guide/template-syntax#ngStyle) 和 [ngClass](guide/template-syntax#ngClass))。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "YOUCANALSOWRITEYOUROWNDIRECTIVESCOMPONENTSSUCHASHEROLISTCOMPONENTAREONEKINDOFCUSTOMDIRECTIVEYOUCANALSOCREATECUSTOMSTRUCTURALANDATTRIBUTEDIRECTIVES", - "original": "You can also write your own directives. Components such as `HeroListComponent` are one kind of custom directive. You can also create custom structural and attribute directives.", - "translation": "你还可以写自己的指令。像 `HeroListComponent` 这样的组件就是一种自定义指令,你还可以创建自定义的结构型指令和属性型指令。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" - }, - { - "key": "#INTRODUCTIONTOMODULES", - "original": "# Introduction to modules", - "translation": "# 模块简介", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "ANGULARAPPSAREMODULARANDANGULARHASITSOWNMODULARITYSYSTEMCALLEDNGMODULESANNGMODULEISACONTAINERFORACOHESIVEBLOCKOFCODEDEDICATEDTOANAPPLICATIONDOMAINAWORKFLOWORACLOSELYRELATEDSETOFCAPABILITIESITCANCONTAINCOMPONENTSSERVICEPROVIDERSANDOTHERCODEFILESWHOSESCOPEISDEFINEDBYTHECONTAININGNGMODULEITCANIMPORTFUNCTIONALITYTHATISEXPORTEDFROMOTHERNGMODULESANDEXPORTSELECTEDFUNCTIONALITYFORUSEBYOTHERNGMODULES", - "original": "Angular apps are modular and Angular has its own modularity system called _NgModules_. An NgModule is a container for a cohesive block of code dedicated to an application domain, a workflow, or a closely related set of capabilities. It can contain components, service providers, and other code files whose scope is defined by the containing NgModule. It can import functionality that is exported from other NgModules, and export selected functionality for use by other NgModules.", - "translation": "Angular 应用是模块化的,它拥有自己的模块化系统,称作 *NgModule*。\n一个 NgModule 就是一个容器,用于存放一些内聚的代码块,这些代码块专注于某个应用领域、某个工作流或一组紧密相关的功能。\n它可以包含一些组件、服务提供商或其它代码文件,其作用域由包含它们的 NgModule 定义。\n它还可以导入一些由其它模块中导出的功能,并导出一些指定的功能供其它 NgModule 使用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "EVERYANGULARAPPHASATLEASTONENGMODULECLASSTHEROOTMODULEGUIDEBOOTSTRAPPINGWHICHISCONVENTIONALLYNAMEDAPPMODULEANDRESIDESINAFILENAMEDAPPMODULETSYOULAUNCHYOURAPPBYBOOTSTRAPPINGTHEROOTNGMODULE", - "original": "Every Angular app has at least one NgModule class, [the _root module_](guide/bootstrapping), which is conventionally named `AppModule` and resides in a file named `app.module.ts`. You launch your app by *bootstrapping* the root NgModule.", - "translation": "每个 Angular 应用都至少有一个 NgModule 类,也就是[根模块](guide/bootstrapping),它习惯上命名为 `AppModule`,并位于一个名叫 `app.module.ts` 的文件中。*引导*这个根模块就可以启动你的应用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "WHILEASMALLAPPLICATIONMIGHTHAVEONLYONENGMODULEMOSTAPPSHAVEMANYMOREFEATUREMODULESTHEROOTNGMODULEFORANAPPISSONAMEDBECAUSEITCANINCLUDECHILDNGMODULESINAHIERARCHYOFANYDEPTH", - "original": "While a small application might have only one NgModule, most apps have many more _feature modules_. The _root_ NgModule for an app is so named because it can include child NgModules in a hierarchy of any depth.", - "translation": "虽然小型的应用可能只有一个 NgModule,不过大多数应用都会有很多*特性模块*。应用的*根模块*之所以叫根模块,是因为它可以包含任意深度的层次化子模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "##NGMODULEMETADATA", - "original": "## NgModule metadata", - "translation": "## `@NgModule` 元数据", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "ANNGMODULEISDEFINEDASACLASSDECORATEDWITHNGMODULETHENGMODULEDECORATORISAFUNCTIONTHATTAKESASINGLEMETADATAOBJECTWHOSEPROPERTIESDESCRIBETHEMODULETHEMOSTIMPORTANTPROPERTIESAREASFOLLOWS", - "original": "An NgModule is defined as a class decorated with `@NgModule`. The `@NgModule` decorator is a function that takes a single metadata object, whose properties describe the module. The most important properties are as follows.", - "translation": "NgModule 是一个带有 `@NgModule` 装饰器的类。`@NgModule` 装饰器是一个函数,它接受一个元数据对象,该对象的属性用来描述这个模块。其中最重要的属性如下。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "DECLARATIONSMDASHTHECOMPONENTSGUIDEARCHITECTURECOMPONENTSDIRECTIVESANDPIPESTHATBELONGTOTHISNGMODULE", - "original": "* `declarations`—The [components](guide/architecture-components), _directives_, and _pipes_ that belong to this NgModule.", - "translation": "`declarations`(可声明对象表) —— 那些属于本 NgModule 的[组件](guide/architecture-components)、*指令*、*管道*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "EXPORTSMDASHTHESUBSETOFDECLARATIONSTHATSHOULDBEVISIBLEANDUSABLEINTHECOMPONENTTEMPLATESOFOTHERNGMODULES", - "original": "* `exports`—The subset of declarations that should be visible and usable in the _component templates_ of other NgModules.", - "translation": "`exports`(导出表) —— 那些能在其它模块的*组件模板*中使用的可声明对象的子集。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "IMPORTSMDASHOTHERMODULESWHOSEEXPORTEDCLASSESARENEEDEDBYCOMPONENTTEMPLATESDECLAREDINTHISNGMODULE", - "original": "* `imports`—Other modules whose exported classes are needed by component templates declared in _this_ NgModule.", - "translation": "`imports`(导入表) —— 那些导出了*本*模块中的组件模板所需的类的其它模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "PROVIDERSMDASHCREATORSOFSERVICESGUIDEARCHITECTURESERVICESTHATTHISNGMODULECONTRIBUTESTOTHEGLOBALCOLLECTIONOFSERVICESTHEYBECOMEACCESSIBLEINALLPARTSOFTHEAPPYOUCANALSOSPECIFYPROVIDERSATTHECOMPONENTLEVELWHICHISOFTENPREFERRED", - "original": "* `providers`—Creators of [services](guide/architecture-services) that this NgModule contributes to the global collection of services; they become accessible in all parts of the app. (You can also specify providers at the component level, which is often preferred.)", - "translation": "`providers` —— 本模块向全局服务中贡献的那些[服务](guide/architecture-services)的创建器。\n 这些服务能被本应用中的任何部分使用。(你也可以在组件级别指定服务提供商,这通常是首选方式。)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "BOOTSTRAPMDASHTHEMAINAPPLICATIONVIEWCALLEDTHEROOTCOMPONENTWHICHHOSTSALLOTHERAPPVIEWSONLYTHEROOTNGMODULESHOULDSETTHISBOOTSTRAPPROPERTY", - "original": "* `bootstrap`—The main application view, called the _root component_, which hosts all other app views. Only the _root NgModule_ should set this `bootstrap` property.", - "translation": "`bootstrap` —— 应用的主视图,称为*根组件*。它是应用中所有其它视图的宿主。只有*根模块*才应该设置这个 `bootstrap` 属性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "HERESASIMPLEROOTNGMODULEDEFINITION:", - "original": "Here's a simple root NgModule definition:", - "translation": "下面是一个简单的根 NgModule 定义:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "THEEXPORTOFAPPCOMPONENTISJUSTTOSHOWHOWTOEXPORTITISNTACTUALLYNECESSARYINTHISEXAMPLEAROOTNGMODULEHASNOREASONTOEXPORTANYTHINGBECAUSEOTHERMODULESDONTNEEDTOIMPORTTHEROOTNGMODULE", - "original": "The `export` of `AppComponent` is just to show how to export; it isn't actually necessary in this example. A root NgModule has no reason to _export_ anything because other modules don't need to _import_ the root NgModule.", - "translation": "把 `AppComponent` 放到 `exports` 中只是为了演示导出的语法,这在本例子中实际上是没必要的。\n 根模块没有任何理由*导出*任何东西,因为其它模块永远不需要*导入*根模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "##NGMODULESANDCOMPONENTS", - "original": "## NgModules and components", - "translation": "## NgModule 和组件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "NGMODULESPROVIDEACOMPILATIONCONTEXTFORTHEIRCOMPONENTSAROOTNGMODULEALWAYSHASAROOTCOMPONENTTHATISCREATEDDURINGBOOTSTRAPBUTANYNGMODULECANINCLUDEANYNUMBEROFADDITIONALCOMPONENTSWHICHCANBELOADEDTHROUGHTHEROUTERORCREATEDTHROUGHTHETEMPLATETHECOMPONENTSTHATBELONGTOANNGMODULESHAREACOMPILATIONCONTEXT", - "original": "NgModules provide a _compilation context_ for their components. A root NgModule always has a root component that is created during bootstrap, but any NgModule can include any number of additional components, which can be loaded through the router or created through the template. The components that belong to an NgModule share a compilation context.", - "translation": "NgModule 为其中的组件提供了一个*编译上下文环境*。根模块总会有一个根组件,并在引导期间创建它。\n但是,任何模块都能包含任意数量的其它组件,这些组件可以通过路由器加载,也可以通过模板创建。那些属于这个 NgModule 的组件会共享同一个编译上下文环境。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "ACOMPONENTANDITSTEMPLATETOGETHERDEFINEAVIEWACOMPONENTCANCONTAINAVIEWHIERARCHYWHICHALLOWSYOUTODEFINEARBITRARILYCOMPLEXAREASOFTHESCREENTHATCANBECREATEDMODIFIEDANDDESTROYEDASAUNITAVIEWHIERARCHYCANMIXVIEWSDEFINEDINCOMPONENTSTHATBELONGTODIFFERENTNGMODULESTHISISOFTENTHECASEESPECIALLYFORUILIBRARIES", - "original": "A component and its template together define a _view_. A component can contain a _view hierarchy_, which allows you to define arbitrarily complex areas of the screen that can be created, modified, and destroyed as a unit. A view hierarchy can mix views defined in components that belong to different NgModules. This is often the case, especially for UI libraries.", - "translation": "组件及其模板共同定义*视图*。组件还可以包含*视图层次结构*,它能让你定义任意复杂的屏幕区域,可以将其作为一个整体进行创建、修改和销毁。\n一个视图层次结构中可以混合使用由不同 NgModule 中的组件定义的视图。\n这种情况很常见,特别是对一些 UI 库来说。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "WHENYOUCREATEACOMPONENTITISASSOCIATEDDIRECTLYWITHASINGLEVIEWCALLEDTHEHOSTVIEWTHEHOSTVIEWCANBETHEROOTOFAVIEWHIERARCHYWHICHCANCONTAINEMBEDDEDVIEWSWHICHAREINTURNTHEHOSTVIEWSOFOTHERCOMPONENTSTHOSECOMPONENTSCANBEINTHESAMENGMODULEORCANBEIMPORTEDFROMOTHERNGMODULESVIEWSINTHETREECANBENESTEDTOANYDEPTH", - "original": "When you create a component, it is associated directly with a single view, called the _host view_. The host view can be the root of a view hierarchy, which can contain _embedded views_, which are in turn the host views of other components. Those components can be in the same NgModule, or can be imported from other NgModules. Views in the tree can be nested to any depth.", - "translation": "当你创建一个组件时,它直接与一个叫做*宿主视图*的视图关联起来。\n宿主视图可以是视图层次结构的根,该视图层次结构可以包含一些*内嵌视图*,这些内嵌视图又是其它组件的宿主视图。\n这些组件可以位于相同的 NgModule 中,也可以从其它 NgModule 中导入。\n树中的视图可以嵌套到任意深度。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "THEHIERARCHICALSTRUCTUREOFVIEWSISAKEYFACTORINTHEWAYANGULARDETECTSANDRESPONDSTOCHANGESINTHEDOMANDAPPDATA", - "original": "The hierarchical structure of views is a key factor in the way Angular detects and responds to changes in the DOM and app data.", - "translation": "视图的这种层次结构是 Angular 在 DOM 和应用数据中检测与响应变更时的关键因素。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "##NGMODULESANDJAVASCRIPTMODULES", - "original": "## NgModules and JavaScript modules", - "translation": "## NgModule 和 JavaScript 的模块", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "THENGMODULESYSTEMISDIFFERENTFROMANDUNRELATEDTOTHEJAVASCRIPTES2015MODULESYSTEMFORMANAGINGCOLLECTIONSOFJAVASCRIPTOBJECTSTHESEARETWODIFFERENTANDCOMPLEMENTARYMODULESYSTEMSYOUCANUSETHEMBOTHTOWRITEYOURAPPS", - "original": "The NgModule system is different from and unrelated to the JavaScript (ES2015) module system for managing collections of JavaScript objects. These are two different and _complementary_ module systems. You can use them both to write your apps.", - "translation": "NgModule 系统与 JavaScript(ES2015)用来管理 JavaScript 对象的模块系统不同,而且也没有直接关联。\n这两种模块系统不同但*互补*。你可以使用它们来共同编写你的应用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "INJAVASCRIPTEACHFILEISAMODULEANDALLOBJECTSDEFINEDINTHEFILEBELONGTOTHATMODULETHEMODULEDECLARESSOMEOBJECTSTOBEPUBLICBYMARKINGTHEMWITHTHEEXPORTKEYWORDOTHERJAVASCRIPTMODULESUSEIMPORTSTATEMENTSTOACCESSPUBLICOBJECTSFROMOTHERMODULES", - "original": "In JavaScript each _file_ is a module and all objects defined in the file belong to that module.\nThe module declares some objects to be public by marking them with the `export` key word.\nOther JavaScript modules use *import statements* to access public objects from other modules.", - "translation": "JavaScript 中,每个*文件*是一个模块,文件中定义的所有对象都从属于那个模块。\n通过 `export` 关键字,模块可以把它的某些对象声明为公共的。\n其它 JavaScript 模块可以使用*import 语句*来访问这些公共对象。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "AHREFHTTP:EXPLORINGJSCOMES6CHMODULESHTMLLEARNMOREABOUTTHEJAVASCRIPTMODULESYSTEMONTHEWEBA", - "original": "Learn more about the JavaScript module system on the web.", - "translation": "学习更多关于 JavaScript 模块的知识。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "##ANGULARLIBRARIES", - "original": "## Angular libraries", - "translation": "## Angular 自带的库", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "ANGULARSHIPSASACOLLECTIONOFJAVASCRIPTMODULESYOUCANTHINKOFTHEMASLIBRARYMODULESEACHANGULARLIBRARYNAMEBEGINSWITHTHEANGULARPREFIXINSTALLTHEMWITHTHENPMPACKAGEMANAGERANDIMPORTPARTSOFTHEMWITHJAVASCRIPTIMPORTSTATEMENTS", - "original": "Angular ships as a collection of JavaScript modules. You can think of them as library modules. Each Angular library name begins with the `@angular` prefix. Install them with the `npm` package manager and import parts of them with JavaScript `import` statements.", - "translation": "Angular 自带了一组 JavaScript 模块,你可以把它们看成库模块。每个 Angular 库的名称都带有 `@angular` 前缀。\n使用 `npm` 包管理器安装它们,并使用 JavaScript 的 `import` 语句导入其中的各个部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "FOREXAMPLEIMPORTANGULARSCOMPONENTDECORATORFROMTHEANGULARCORELIBRARYLIKETHIS:", - "original": "For example, import Angular's `Component` decorator from the `@angular/core` library like this:", - "translation": "例如,象下面这样,从 `@angular/core` 库中导入 `Component` 装饰器:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "YOUALSOIMPORTNGMODULESFROMANGULARLIBRARIESUSINGJAVASCRIPTIMPORTSTATEMENTS:", - "original": "You also import NgModules from Angular _libraries_ using JavaScript import statements:", - "translation": "还可以使用 JavaScript 的导入语句从 Angular *库*中导入 Angular *模块*:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "INTHEEXAMPLEOFTHESIMPLEROOTMODULEABOVETHEAPPLICATIONMODULENEEDSMATERIALFROMWITHINTHEBROWSERMODULETOACCESSTHATMATERIALADDITTOTHENGMODULEMETADATAIMPORTSLIKETHIS", - "original": "In the example of the simple root module above, the application module needs material from within the `BrowserModule`. To access that material, add it to the `@NgModule` metadata `imports` like this.", - "translation": "在上面这个简单的根模块范例中,应用的根模块需要来自 `BrowserModule` 中的素材。要访问这些素材,就要把它加入 `@NgModule` 元数据的 `imports` 中,代码如下:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "INTHISWAYYOUREUSINGBOTHTHEANGULARANDJAVASCRIPTMODULESYSTEMSTOGETHERALTHOUGHITSEASYTOCONFUSETHETWOSYSTEMSWHICHSHARETHECOMMONVOCABULARYOFIMPORTSANDEXPORTSYOUWILLBECOMEFAMILIARWITHTHEDIFFERENTCONTEXTSINWHICHTHEYAREUSED", - "original": "In this way you're using both the Angular and JavaScript module systems _together_. Although it's easy to confuse the two systems, which share the common vocabulary of \"imports\" and \"exports\", you will become familiar with the different contexts in which they are used.", - "translation": "通过这种方式,你可以*同时*使用 Angular 和 JavaScript 的这两种模块系统。\n虽然这两种模块系统容易混淆(它们共享了同样的词汇 `import` 和`export`),不过只要多用用你就会熟悉它们各自的语境了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "LEARNMOREFROMTHENGMODULESGUIDENGMODULESPAGE", - "original": "Learn more from the [NgModules](guide/ngmodules) page.", - "translation": "更多信息,参见 [NgModules](guide/ngmodules)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-modules.md" - }, - { - "key": "#NEXTSTEPS:TOOLSANDTECHNIQUES", - "original": "# Next steps: tools and techniques", - "translation": "# 后续步骤:工具与技巧", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "ONCEYOUHAVEUNDERSTOODTHEBASICBUILDINGBLOCKSYOUCANBEGINTOLEARNMOREABOUTTHEFEATURESANDTOOLSTHATAREAVAILABLETOHELPYOUDEVELOPANDDELIVERANGULARAPPLICATIONSANGULARPROVIDESALOTMOREFEATURESANDSERVICESTHATARECOVEREDINTHISDOCUMENTATION", - "original": "Once you have understood the basic building blocks, you can begin to learn more about the features and tools that are available to help you develop and deliver Angular applications. Angular provides a lot more features and services that are covered in this documentation.", - "translation": "一旦你理解了这些基本构造块,就可以开始学习更多能帮你开发和交付 Angular 应用的特性和工具了。\nAngular 提供了本文档中所包含的很多特性和服务。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "####RESPONSIVEPROGRAMMINGTOOLS", - "original": "#### Responsive programming tools", - "translation": "#### 响应式编程工具", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "LIFECYCLEHOOKSGUIDELIFECYCLEHOOKS:TAPINTOKEYMOMENTSINTHELIFETIMEOFACOMPONENTFROMITSCREATIONTOITSDESTRUCTIONBYIMPLEMENTINGTHELIFECYCLEHOOKINTERFACES", - "original": "* [Lifecycle hooks](guide/lifecycle-hooks): Tap into key moments in the lifetime of a component, from its creation to its destruction, by implementing the lifecycle hook interfaces.", - "translation": "[生命周期钩子](guide/lifecycle-hooks):通过实现生命周期钩子接口,可以窃听组件生命周期中的一些关键时刻 —— 从创建到销毁。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "OBSERVABLESANDEVENTPROCESSINGGUIDEOBSERVABLES:HOWTOUSEOBSERVABLESWITHCOMPONENTSANDSERVICESTOPUBLISHANDSUBSCRIBETOMESSAGESOFANYTYPESUCHASUSERINTERACTIONEVENTSANDASYNCHRONOUSOPERATIONRESULTS", - "original": "* [Observables and event processing](guide/observables): How to use observables with components and services to publish and subscribe to messages of any type, such as user-interaction events and asynchronous operation results.", - "translation": "[可观察对象(Observable)和事件处理](guide/observables):如何在组件和服务中使用可观察对象来发布和订阅任意类型的消息,比如用户交互事件和异步操作结果。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "####CLIENTSERVERINTERACTIONTOOLS", - "original": "#### Client-server interaction tools", - "translation": "#### 客户端与服务器的交互工具", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "HTTPGUIDEHTTP:COMMUNICATEWITHASERVERTOGETDATASAVEDATAANDINVOKESERVERSIDEACTIONSWITHANHTTPCLIENT", - "original": "* [HTTP](guide/http): Communicate with a server to get data, save data, and invoke server-side actions with an HTTP client.", - "translation": "[HTTP](guide/http):用 HTTP 客户端与服务器通讯,以获取数据、保存数据或执行服务端动作。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "SERVERSIDERENDERINGGUIDEUNIVERSAL:ANGULARUNIVERSALGENERATESSTATICAPPLICATIONPAGESONTHESERVERTHROUGHSERVERSIDERENDERINGSSRTHISALLOWSYOUTORUNYOURANGULARAPPONTHESERVERINORDERTOIMPROVEPERFORMANCEANDSHOWTHEFIRSTPAGEQUICKLYONMOBILEANDLOWPOWEREDDEVICESANDALSOFACILITATEWEBCRAWLERS", - "original": "* [Server-side Rendering](guide/universal): Angular Universal generates static application pages on the server through server-side rendering (SSR). This allows you to run your Angular app on the server in order to improve performance and show the first page quickly on mobile and low-powered devices, and also facilitate web crawlers.", - "translation": "[服务端渲染](guide/universal):Angular Universal 会通过服务端渲染(SSR)技术在服务器上生成静态的应用页面。\n 这让你可以在服务器上运行 Angular 应用,以提升性能并在手机或低功耗设备上快速显示首屏,并为 Web 爬虫提供帮助(SEO)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "SERVICEWORKERSGUIDESERVICEWORKERINTRO:ASERVICEWORKERISASCRIPTTHATRUNSINTHEWEBBROWSERANDMANAGESCACHINGFORANAPPLICATIONSERVICEWORKERSFUNCTIONASANETWORKPROXYTHEYINTERCEPTOUTGOINGHTTPREQUESTSANDCANFOREXAMPLEDELIVERACACHEDRESPONSEIFONEISAVAILABLEYOUCANSIGNIFICANTLYIMPROVETHEUSEREXPERIENCEBYUSINGASERVICEWORKERTOREDUCEDEPENDENCYONTHENETWORK", - "original": "* [Service Workers](guide/service-worker-intro): A service worker is a script that runs in the web browser and manages caching for an application. Service workers function as a network proxy. They intercept outgoing HTTP requests and can, for example, deliver a cached response if one is available. You can significantly improve the user experience by using a service worker to reduce dependency on the network.", - "translation": "[Service Worker](guide/service-worker-intro):Service Worker 是一个运行在浏览器中并为应用管理缓存的脚本。\n Service Worker 的功能类似于网络代理。它们会拦截发出的 HTTP 请求,如果存在已缓存的响应,则直接返回它。通过使用 Service Worker 来减轻对网络的依赖,你可以显著提升用户体验。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "####DOMAINSPECIFICLIBRARIES", - "original": "#### Domain-specific libraries", - "translation": "#### 特定领域的库", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "ANIMATIONSGUIDEANIMATIONS:ANIMATECOMPONENTBEHAVIORWITHOUTDEEPKNOWLEDGEOFANIMATIONTECHNIQUESORCSSWITHANGULARSANIMATIONLIBRARY", - "original": "* [Animations](guide/animations): Animate component behavior\nwithout deep knowledge of animation techniques or CSS with Angular's animation library.", - "translation": "[动画](guide/animations):使用 Angular 的动画库,你可以让组件支持动画行为,而不用深入了解动画技术或 CSS。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "FORMSGUIDEFORMS:SUPPORTCOMPLEXDATAENTRYSCENARIOSWITHHTMLBASEDVALIDATIONANDDIRTYCHECKING", - "original": "* [Forms](guide/forms): Support complex data entry scenarios with HTML-based validation and dirty checking.", - "translation": "[Forms](guide/forms):通过基于 HTML 的验证和脏数据检查,来支持复杂的数据输入场景。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "####SUPPORTFORTHEDEVELOPMENTCYCLE", - "original": "#### Support for the development cycle", - "translation": "#### 为开发周期提供支持", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "TESTINGPLATFORMGUIDETESTING:RUNUNITTESTSONYOURAPPLICATIONPARTSASTHEYINTERACTWITHTHEANGULARFRAMEWORK", - "original": "* [Testing Platform](guide/testing): Run unit tests on your application parts as they interact with the Angular framework.", - "translation": "[测试平台](guide/testing):对应用的各个部件运行单元测试,让它们好像在和 Angular 框架交互一样。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "INTERNATIONALIZATIONGUIDEI18N:ANGULARSINTERNATIONALIZATIONI18NTOOLSCANHELPYOUMAKEYOURAPPAVAILABLEINMULTIPLELANGUAGES", - "original": "* [Internationalization](guide/i18n): Angular's internationalization (i18n) tools can help you make your app available in multiple languages.", - "translation": "[国际化](guide/i18n):Angular 的国际化工具可以帮助你让应用可用于多种语言中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "COMPILATIONGUIDEAOTCOMPILER:ANGULARPROVIDESJUSTINTIMEJITCOMPILATIONFORTHEDEVELOPMENTENVIRONMENTANDAHEADOFTIMEAOTCOMPILATIONFORTHEPRODUCTIONENVIRONMENT", - "original": "* [Compilation](guide/aot-compiler): Angular provides just-in-time (JIT) compilation for the development environment, and ahead-of-time (AOT) compilation for the production environment.", - "translation": "[编译](guide/aot-compiler):Angular 为开发环境提供了 JIT(即时)编译方式,为生产环境提供了 AOT(预先)编译方式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "SECURITYGUIDELINESGUIDESECURITY:LEARNABOUTANGULARSBUILTINPROTECTIONSAGAINSTCOMMONWEBAPPVULNERABILITIESANDATTACKSSUCHASCROSSSITESCRIPTINGATTACKS", - "original": "* [Security guidelines](guide/security): Learn about Angular's built-in protections against common web-app vulnerabilities and attacks such as cross-site scripting attacks.", - "translation": "[安全指南](guide/security):学习 Angular 对常见 Web 应用的弱点和工具(比如跨站脚本攻击)提供的内置防护措施。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "####SETUPANDDEPLOYMENTTOOLS", - "original": "#### Setup and deployment tools", - "translation": "#### 环境搭建和发布工具", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "SETUPFORLOCALDEVELOPMENTGUIDESETUP:LEARNHOWTOSETUPANEWPROJECTFORDEVELOPMENTWITHQUICKSTART", - "original": "* [Setup for local development](guide/setup): Learn how to set up a new project for development with QuickStart.", - "translation": "[搭建本地开发环境](guide/setup):学习如何搭建用来开发《快速起步》的新项目。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "INSTALLATIONGUIDENPMPACKAGES:THEANGULARCLIHTTPS:CLIANGULARIOANGULARAPPLICATIONSANDANGULARITSELFDEPENDONFEATURESANDFUNCTIONALITYPROVIDEDBYLIBRARIESTHATAREAVAILABLEASNPMHTTPS:DOCSNPMJSCOMPACKAGES", - "original": "* [Installation](guide/npm-packages): The [Angular CLI](https://cli.angular.io/), Angular applications, and Angular itself depend on features and functionality provided by libraries that are available as [npm](https://docs.npmjs.com/) packages.", - "translation": "[安装](guide/npm-packages):[Angular CLI](https://cli.angular.io/) 应用和 Angular 本身依赖于一些由库提供的特性和功能,这些库都是以 [npm](https://docs.npmjs.com/) 包的形式发布的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "TYPESCRIPTCONFIGURATIONGUIDETYPESCRIPTCONFIGURATION:TYPESCRIPTISTHEPRIMARYLANGUAGEFORANGULARAPPLICATIONDEVELOPMENT", - "original": "* [Typescript Configuration](guide/typescript-configuration): TypeScript is the primary language for Angular application development.", - "translation": "[TypeScript 配置](guide/typescript-configuration):TypeScript 是 Angular 应用开发的主要语言。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "BROWSERSUPPORTGUIDEBROWSERSUPPORT:LEARNHOWTOMAKEYOURAPPSCOMPATIBLEACROSSAWIDERANGEOFBROWSERS", - "original": "* [Browser support](guide/browser-support): Learn how to make your apps compatible across a wide range of browsers.", - "translation": "[浏览器支持](guide/browser-support):学习如何让你的应用能和各种浏览器兼容。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "DEPLOYMENTGUIDEDEPLOYMENT:LEARNTECHNIQUESFORDEPLOYINGYOURANGULARAPPLICATIONTOAREMOTESERVER", - "original": "* [Deployment](guide/deployment): Learn techniques for deploying your Angular application to a remote server.", - "translation": "[发布](guide/deployment):学习把你的应用发布到远端服务器的技巧。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-next-steps.md" - }, - { - "key": "#INTRODUCTIONTOSERVICESANDDEPENDENCYINJECTION", - "original": "# Introduction to services and dependency injection", - "translation": "# 服务与依赖注入简介", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "SERVICEISABROADCATEGORYENCOMPASSINGANYVALUEFUNCTIONORFEATURETHATANAPPNEEDSASERVICEISTYPICALLYACLASSWITHANARROWWELLDEFINEDPURPOSEITSHOULDDOSOMETHINGSPECIFICANDDOITWELL", - "original": "_Service_ is a broad category encompassing any value, function, or feature that an app needs. A service is typically a class with a narrow, well-defined purpose. It should do something specific and do it well.", - "translation": "*服务*是一个广义的概念,它包括应用所需的任何值、函数或特性。狭义的服务是一个明确定义了用途的类。它应该做一些具体的事,并做好。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "ANGULARDISTINGUISHESCOMPONENTSFROMSERVICESINORDERTOINCREASEMODULARITYANDREUSABILITY", - "original": "Angular distinguishes components from services in order to increase modularity and reusability.", - "translation": "Angular 把组件和服务区分开,以提高模块性和复用性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "BYSEPARATINGACOMPONENTSVIEWRELATEDFUNCTIONALITYFROMOTHERKINDSOFPROCESSINGYOUCANMAKEYOURCOMPONENTCLASSESLEANANDEFFICIENTIDEALLYACOMPONENTSJOBISTOENABLETHEUSEREXPERIENCEANDNOTHINGMOREITSHOULDPRESENTPROPERTIESANDMETHODSFORDATABINDINGINORDERTOMEDIATEBETWEENTHEVIEWRENDEREDBYTHETEMPLATEANDTHEAPPLICATIONLOGICWHICHOFTENINCLUDESSOMENOTIONOFAMODEL", - "original": "* By separating a component's view-related functionality from other kinds of processing, you can make your component classes lean and efficient. Ideally, a component's job is to enable the user experience and nothing more. It should present properties and methods for data binding, in order to mediate between the view (rendered by the template) and the application logic (which often includes some notion of a _model_).", - "translation": "通过把组件中和视图有关的功能与其他类型的处理分离开,你可以让组件类更加精简、高效。\n 理想情况下,组件的工作只管用户体验,而不用顾及其它。\n 它应该提供用于数据绑定的属性和方法,以便作为视图(由模板渲染)和应用逻辑(通常包含一些模型的概念)的中介者。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "ACOMPONENTSHOULDNOTNEEDTODEFINETHINGSLIKEHOWTOFETCHDATAFROMTHESERVERVALIDATEUSERINPUTORLOGDIRECTLYTOTHECONSOLEINSTEADITCANDELEGATESUCHTASKSTOSERVICESBYDEFININGTHATKINDOFPROCESSINGTASKINANINJECTABLESERVICECLASSYOUMAKEITAVAILABLETOANYCOMPONENTYOUCANALSOMAKEYOURAPPMOREADAPTABLEBYINJECTINGDIFFERENTPROVIDERSOFTHESAMEKINDOFSERVICEASAPPROPRIATEINDIFFERENTCIRCUMSTANCES", - "original": "* A component should not need to define things like how to fetch data from the server, validate user input, or log directly to the console. Instead, it can delegate such tasks to services. By defining that kind of processing task in an injectable service class, you make it available to any component. You can also make your app more adaptable by injecting different providers of the same kind of service, as appropriate in different circumstances.", - "translation": "组件不应该定义任何诸如从服务器获取数据、验证用户输入或直接往控制台中写日志等工作。\n 而要把这些任务委托给各种服务。通过把各种处理任务定义到可注入的服务类中,你可以让它被任何组件使用。\n 通过在不同的环境中注入同一种服务的不同提供商,你还可以让你的应用更具适应性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "ANGULARDOESNTENFORCETHESEPRINCIPLESANGULARDOESHELPYOUFOLLOWTHESEPRINCIPLESBYMAKINGITEASYTOFACTORYOURAPPLICATIONLOGICINTOSERVICESANDMAKETHOSESERVICESAVAILABLETOCOMPONENTSTHROUGHDEPENDENCYINJECTION", - "original": "Angular doesn't *enforce* these principles. Angular does help you *follow* these principles by making it easy to factor your\napplication logic into services and make those services available to components through *dependency injection*.", - "translation": "Angular 不会*强制*遵循这些原则。它只会通过*依赖注入*让你能更容易地将应用逻辑分解为服务,并让这些服务可用于各个组件中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "##SERVICEEXAMPLES", - "original": "## Service examples", - "translation": "## 服务范例", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "HERESANEXAMPLEOFASERVICECLASSTHATLOGSTOTHEBROWSERCONSOLE:", - "original": "Here's an example of a service class that logs to the browser console:", - "translation": "下面是一个服务类的范例,用于把日志记录到浏览器的控制台:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "SERVICESCANDEPENDONOTHERSERVICESFOREXAMPLEHERESAHEROSERVICETHATDEPENDSONTHELOGGERSERVICEANDALSOUSESBACKENDSERVICETOGETHEROESTHATSERVICEINTURNMIGHTDEPENDONTHEHTTPCLIENTSERVICETOFETCHHEROESASYNCHRONOUSLYFROMASERVER", - "original": "Services can depend on other services. For example, here's a `HeroService` that depends on the `Logger` service, and also uses `BackendService` to get heroes. That service in turn might depend on the `HttpClient` service to fetch heroes asynchronously from a server.", - "translation": "服务也可以依赖其它服务。比如,这里的 `HeroService` 就依赖于 `Logger` 服务,它还用 `BackendService` 来获取英雄数据。`BackendService` 还可能再转而依赖 `HttpClient` 服务来从服务器异步获取英雄列表。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "##DEPENDENCYINJECTION", - "original": "## Dependency injection", - "translation": "## 依赖注入(dependency injection)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "COMPONENTSCONSUMESERVICESTHATISYOUCANINJECTASERVICEINTOACOMPONENTGIVINGTHECOMPONENTACCESSTOTHATSERVICECLASS", - "original": "Components consume services; that is, you can *inject* a service into a component, giving the component access to that service class.", - "translation": "组件是服务的消费者,也就是说,你可以把一个服务*注入*到组件中,让组件类得以访问该服务类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "TODEFINEACLASSASASERVICEINANGULARUSETHEINJECTABLEDECORATORTOPROVIDETHEMETADATATHATALLOWSANGULARTOINJECTITINTOACOMPONENTASADEPENDENCY", - "original": "To define a class as a service in Angular, use the `@Injectable` decorator to provide the metadata that allows Angular to inject it into a component as a *dependency*.", - "translation": "在 Angular 中,要把一个类定义为服务,就要用 `@Injectable` 装饰器来提供元数据,以便让 Angular 可以把它作为*依赖*注入到组件中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "SIMILARLYUSETHEINJECTABLEDECORATORTOINDICATETHATACOMPONENTOROTHERCLASSSUCHASANOTHERSERVICEAPIPEORANNGMODULEHASADEPENDENCYADEPENDENCYDOESNTHAVETOBEASERVICEMDASHITCOULDBEAFUNCTIONFOREXAMPLEORAVALUE", - "original": "Similarly, use the `@Injectable` decorator to indicate that a component or other class (such as another service, a pipe, or an NgModule) _has_ a dependency. A dependency doesn't have to be a service—it could be a function, for example, or a value.", - "translation": "同样,也要使用 `@Injectable` 装饰器来表明一个组件或其它类(比如另一个服务、管道或 NgModule)*拥有*一个依赖。\n依赖并不必然是服务,它也可能是函数或值等等。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "DEPENDENCYINJECTIONOFTENCALLEDDIISWIREDINTOTHEANGULARFRAMEWORKANDUSEDEVERYWHERETOPROVIDENEWCOMPONENTSWITHTHESERVICESOROTHERTHINGSTHEYNEED", - "original": "*Dependency injection* (often called DI) is wired into the Angular framework and used everywhere to provide new components with the services or other things they need.", - "translation": "*依赖注入*(通常简称 DI)被引入到 Angular 框架中,并且到处使用它,来为新建的组件提供所需的服务或其它东西。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "THEINJECTORISTHEMAINMECHANISMYOUDONTHAVETOCREATEANANGULARINJECTORANGULARCREATESANAPPLICATIONWIDEINJECTORFORYOUDURINGTHEBOOTSTRAPPROCESS", - "original": "* The *injector* is the main mechanism. You don't have to create an Angular injector. Angular creates an application-wide injector for you during the bootstrap process.", - "translation": "*注入器*是主要的机制。你不用自己创建 Angular 注入器。Angular 会在启动过程中为你创建全应用级注入器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "THEINJECTORMAINTAINSACONTAINEROFDEPENDENCYINSTANCESTHATITHASALREADYCREATEDANDREUSESTHEMIFPOSSIBLE", - "original": "* The injector maintains a *container* of dependency instances that it has already created, and reuses them if possible.", - "translation": "该注入器维护一个包含它已创建的依赖实例的*容器*,并尽可能复用它们。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "APROVIDERISARECIPEFORCREATINGADEPENDENCYFORASERVICETHISISTYPICALLYTHESERVICECLASSITSELFFORANYDEPENDENCYYOUNEEDINYOURAPPYOUMUSTREGISTERAPROVIDERWITHTHEAPPSINJECTORSOTHATTHEINJECTORCANUSEITTOCREATENEWINSTANCES", - "original": "* A *provider* is a recipe for creating a dependency. For a service, this is typically the service class itself. For any dependency you need in your app, you must register a provider with the app's injector, so that the injector can use it to create new instances.", - "translation": "*提供商*是一个创建依赖的菜谱。对于服务来说,它通常就是这个服务类本身。你在应用中要用到的任何类都必须使用该应用的注入器注册一个提供商,以便注入器可以使用它来创建新实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "WHENANGULARCREATESANEWINSTANCEOFACOMPONENTCLASSITDETERMINESWHICHSERVICESOROTHERDEPENDENCIESTHATCOMPONENTNEEDSBYLOOKINGATTHETYPESOFITSCONSTRUCTORPARAMETERSFOREXAMPLETHECONSTRUCTOROFHEROLISTCOMPONENTNEEDSAHEROSERVICE:", - "original": "When Angular creates a new instance of a component class, it determines which services or other dependencies that component needs by looking at the types of its constructor parameters. For example, the constructor of `HeroListComponent` needs a `HeroService`:", - "translation": "当 Angular 创建组件类的新实例时,它会通过查看该组件类的构造函数,来决定该组件依赖哪些服务或其它依赖项。\n比如 `HeroListComponent` 的构造函数中需要 `HeroService`:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "WHENANGULARDISCOVERSTHATACOMPONENTDEPENDSONASERVICEITFIRSTCHECKSIFTHEINJECTORALREADYHASANYEXISTINGINSTANCESOFTHATSERVICEIFAREQUESTEDSERVICEINSTANCEDOESNOTYETEXISTTHEINJECTORMAKESONEUSINGTHEREGISTEREDPROVIDERANDADDSITTOTHEINJECTORBEFORERETURNINGTHESERVICETOANGULAR", - "original": "When Angular discovers that a component depends on a service, it first checks if the injector already has any existing instances of that service. If a requested service instance does not yet exist, the injector makes one using the registered provider, and adds it to the injector before returning the service to Angular.", - "translation": "当 Angular 发现某个组件依赖某个服务时,它会首先检查是否该注入器中已经有了那个服务的任何现有实例。如果所请求的服务尚不存在,注入器就会使用以前注册的服务提供商来制作一个,并把它加入注入器中,然后把该服务返回给 Angular。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "WHENALLREQUESTEDSERVICESHAVEBEENRESOLVEDANDRETURNEDANGULARCANCALLTHECOMPONENTSCONSTRUCTORWITHTHOSESERVICESASARGUMENTS", - "original": "When all requested services have been resolved and returned, Angular can call the component's constructor with those services as arguments.", - "translation": "当所有请求的服务已解析并返回时,Angular 可以用这些服务实例为参数,调用该组件的构造函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "THEPROCESSOFHEROSERVICEINJECTIONLOOKSSOMETHINGLIKETHIS:", - "original": "The process of `HeroService` injection looks something like this:", - "translation": "`HeroService` 的注入过程如下所示:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "###PROVIDINGSERVICES", - "original": "### Providing services", - "translation": "### 提供服务", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "YOUMUSTREGISTERATLEASTONEPROVIDEROFANYSERVICEYOUAREGOINGTOUSEYOUCANREGISTERPROVIDERSINMODULESORINCOMPONENTS", - "original": "You must register at least one *provider* of any service you are going to use. You can register providers in modules or in components.", - "translation": "对于要用到的任何服务,你必须至少注册一个*提供商*。你可以在模块中或者组件中注册这些提供商。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "WHENYOUADDPROVIDERSTOTHEROOTMODULEGUIDEARCHITECTUREMODULESTHESAMEINSTANCEOFASERVICEISAVAILABLETOALLCOMPONENTSINYOURAPP", - "original": "* When you add providers to the [root module](guide/architecture-modules), the same instance of a service is available to all components in your app.", - "translation": "当你往[根模块](guide/architecture-modules)中添加服务提供商时,服务的同一个实例会服务于你应用中的所有组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "WHENYOUREGISTERAPROVIDERATTHECOMPONENTLEVELYOUGETANEWINSTANCEOFTHESERVICEWITHEACHNEWINSTANCEOFTHATCOMPONENTATTHECOMPONENTLEVELREGISTERASERVICEPROVIDERINTHEPROVIDERSPROPERTYOFTHECOMPONENTMETADATA:", - "original": "* When you register a provider at the component level, you get a new instance of the\nservice with each new instance of that component. At the component level, register a service provider in the `providers` property of the `@Component` metadata:", - "translation": "当你在组件级注册提供商时,你会为该组件的每一个新实例提供该服务的一个新实例。\n 要在组件级注册,就要在 `@Component` 元数据的 `providers` 属性中注册服务提供商。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "FORMOREDETAILEDINFORMATIONSEETHEDEPENDENCYINJECTIONGUIDEDEPENDENCYINJECTIONSECTION", - "original": "For more detailed information, see the [Dependency Injection](guide/dependency-injection) section.", - "translation": "要了解更多细节,请参见[依赖注入](guide/dependency-injection)一节。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-services.md" - }, - { - "key": "#ARCHITECTUREOVERVIEW", - "original": "# Architecture overview", - "translation": "# 架构概览", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "ANGULARISAPLATFORMANDFRAMEWORKFORBUILDINGCLIENTAPPLICATIONSINHTMLANDTYPESCRIPTANGULARISITSELFWRITTENINTYPESCRIPTITIMPLEMENTSCOREANDOPTIONALFUNCTIONALITYASASETOFTYPESCRIPTLIBRARIESTHATYOUIMPORTINTOYOURAPPS", - "original": "Angular is a platform and framework for building client applications in HTML and TypeScript.\nAngular is itself written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your apps.", - "translation": "Angular 是一个用 HTML 和 TypeScript 构建客户端应用的平台与框架。\nAngular 本身使用 TypeScript 写成的。它将核心功能和可选功能作为一组 TypeScript 库进行实现,你可以把它们导入你的应用中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "THEBASICBUILDINGBLOCKSOFANANGULARAPPLICATIONARENGMODULESWHICHPROVIDEACOMPILATIONCONTEXTFORCOMPONENTSNGMODULESCOLLECTRELATEDCODEINTOFUNCTIONALSETSANANGULARAPPISDEFINEDBYASETOFNGMODULESANAPPALWAYSHASATLEASTAROOTMODULETHATENABLESBOOTSTRAPPINGANDTYPICALLYHASMANYMOREFEATUREMODULES", - "original": "The basic building blocks of an Angular application are _NgModules_, which provide a compilation context for _components_. NgModules collect related code into functional sets; an Angular app is defined by a set of NgModules. An app always has at least a _root module_ that enables bootstrapping, and typically has many more _feature modules_.", - "translation": "Angular 的基本构造块是 *NgModule*,它为*组件*提供了编译的上下文环境。\nNgModule 会把相关的代码收集到一些功能集中。Angular 应用就是由一组 NgModule 定义出的。\n应用至少会有一个用于引导应用的*根模块*,通常还会有很多*特性模块*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "COMPONENTSDEFINEVIEWSWHICHARESETSOFSCREENELEMENTSTHATANGULARCANCHOOSEAMONGANDMODIFYACCORDINGTOYOURPROGRAMLOGICANDDATAEVERYAPPHASATLEASTAROOTCOMPONENT", - "original": "* Components define *views*, which are sets of screen elements that Angular can choose among and modify according to your program logic and data. Every app has at least a root component.", - "translation": "组件定义*视图*。视图是一组可见的屏幕元素,Angular 可以根据你的程序逻辑和数据来选择和修改它们。\n 每个应用都至少有一个根组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "COMPONENTSUSESERVICESWHICHPROVIDESPECIFICFUNCTIONALITYNOTDIRECTLYRELATEDTOVIEWSSERVICEPROVIDERSCANBEINJECTEDINTOCOMPONENTSASDEPENDENCIESMAKINGYOURCODEMODULARREUSABLEANDEFFICIENT", - "original": "* Components use *services*, which provide specific functionality not directly related to views. Service providers can be *injected* into components as *dependencies*, making your code modular, reusable, and efficient.", - "translation": "组件使用*服务*。服务会提供那些与视图不直接相关的功能。服务提供商可以作为*依赖*被*注入*到组件中,\n 这能让你的代码更加模块化、可复用,而且高效。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "BOTHCOMPONENTSANDSERVICESARESIMPLYCLASSESWITHDECORATORSTHATMARKTHEIRTYPEANDPROVIDEMETADATATHATTELLSANGULARHOWTOUSETHEM", - "original": "Both components and services are simply classes, with *decorators* that mark their type and provide metadata that tells Angular how to use them.", - "translation": "组件和服务都是简单的类,这些类使用*装饰器*来标出它们的类型,并提供元数据以告知 Angular 该如何使用它们。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "THEMETADATAFORACOMPONENTCLASSASSOCIATESITWITHATEMPLATETHATDEFINESAVIEWATEMPLATECOMBINESORDINARYHTMLWITHANGULARDIRECTIVESANDBINDINGMARKUPTHATALLOWANGULARTOMODIFYTHEHTMLBEFORERENDERINGITFORDISPLAY", - "original": "* The metadata for a component class associates it with a *template* that defines a view. A template combines ordinary HTML with Angular *directives* and *binding markup* that allow Angular to modify the HTML before rendering it for display.", - "translation": "组件类的元数据将组件类和一个用来定义视图的*模板*关联起来。\n 模板把普通的 HTML 和*指令*与*绑定标记(markup)*组合起来,这样 Angular 就可以在呈现 HTML 之前先修改这些 HTML。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "THEMETADATAFORASERVICECLASSPROVIDESTHEINFORMATIONANGULARNEEDSTOMAKEITAVAILABLETOCOMPONENTSTHROUGHDEPENDENCYINJECTIONDI", - "original": "* The metadata for a service class provides the information Angular needs to make it available to components through *Dependency Injection (DI)*.", - "translation": "服务的元数据提供了一些信息,Angular 要用这些信息来让组件可以通过*依赖注入(DI)*使用该服务。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "ANAPPSCOMPONENTSTYPICALLYDEFINEMANYVIEWSARRANGEDHIERARCHICALLYANGULARPROVIDESTHEROUTERSERVICETOHELPYOUDEFINENAVIGATIONPATHSAMONGVIEWSTHEROUTERPROVIDESSOPHISTICATEDINBROWSERNAVIGATIONALCAPABILITIES", - "original": "An app's components typically define many views, arranged hierarchically. Angular provides the `Router` service to help you define navigation paths among views. The router provides sophisticated in-browser navigational capabilities.", - "translation": "应用的组件通常会定义很多视图,并进行分级组织。 Angular 提供了 `Router` 服务来帮助你定义视图之间的导航路径。\n路由器提供了先进的浏览器内导航功能。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "##MODULES", - "original": "## Modules", - "translation": "## 模块", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "ANGULARDEFINESTHENGMODULEWHICHDIFFERSFROMANDCOMPLEMENTSTHEJAVASCRIPTES2015MODULEANNGMODULEDECLARESACOMPILATIONCONTEXTFORASETOFCOMPONENTSTHATISDEDICATEDTOANAPPLICATIONDOMAINAWORKFLOWORACLOSELYRELATEDSETOFCAPABILITIESANNGMODULECANASSOCIATEITSCOMPONENTSWITHRELATEDCODESUCHASSERVICESTOFORMFUNCTIONALUNITS", - "original": "Angular defines the `NgModule`, which differs from and complements the JavaScript (ES2015) module. An NgModule declares a compilation context for a set of components that is dedicated to an application domain, a workflow, or a closely related set of capabilities. An NgModule can associate its components with related code, such as services, to form functional units.", - "translation": "Angular 定义了 `NgModule`,它和 JavaScript(ES2015) 的模块不同而且有一定的互补性。\nNgModule 为一个组件集声明了编译的上下文环境,它专注于某个应用领域、某个工作流或一组紧密相关的能力。\nNgModule 可以将其组件和一组相关代码(如服务)关联起来,形成功能单元。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "EVERYANGULARAPPHASAROOTMODULECONVENTIONALLYNAMEDAPPMODULEWHICHPROVIDESTHEBOOTSTRAPMECHANISMTHATLAUNCHESTHEAPPLICATIONANAPPTYPICALLYCONTAINSMANYFUNCTIONALMODULES", - "original": "Every Angular app has a _root module_, conventionally named `AppModule`, which provides the bootstrap mechanism that launches the application. An app typically contains many functional modules.", - "translation": "每个 Angular 应用都有一个*根模块*,通常命名为 `AppModule`。根模块提供了用来启动应用的引导机制。\n一个应用通常会包含很多功能模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "LIKEJAVASCRIPTMODULESNGMODULESCANIMPORTFUNCTIONALITYFROMOTHERNGMODULESANDALLOWTHEIROWNFUNCTIONALITYTOBEEXPORTEDANDUSEDBYOTHERNGMODULESFOREXAMPLETOUSETHEROUTERSERVICEINYOURAPPYOUIMPORTTHEROUTERNGMODULE", - "original": "Like JavaScript modules, NgModules can import functionality from other NgModules, and allow their own functionality to be exported and used by other NgModules. For example, to use the router service in your app, you import the `Router` NgModule.", - "translation": "像 JavaScript 模块一样,NgModule 也可以从其它 NgModule 中导入功能,并允许导出它们自己的功能供其它 NgModule 使用。\n比如,要在你的应用中使用路由器(Router)服务,就要导入 `Router` 这个 NgModule。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "ORGANIZINGYOURCODEINTODISTINCTFUNCTIONALMODULESHELPSINMANAGINGDEVELOPMENTOFCOMPLEXAPPLICATIONSANDINDESIGNINGFORREUSABILITYINADDITIONTHISTECHNIQUELETSYOUTAKEADVANTAGEOFLAZYLOADINGMDASHTHATISLOADINGMODULESONDEMANDMDASHINORDERTOMINIMIZETHEAMOUNTOFCODETHATNEEDSTOBELOADEDATSTARTUP", - "original": "Organizing your code into distinct functional modules helps in managing development of complex applications, and in designing for reusability. In addition, this technique lets you take advantage of _lazy-loading_—that is, loading modules on demand—in order to minimize the amount of code that needs to be loaded at startup.", - "translation": "把你的代码组织成一些清晰的功能模块,可以帮助管理复杂应用的开发工作并实现可复用性设计。\n另外,这项技术还能让你获得*惰性加载*(也就是按需加载模块)的优点,以尽可能减小启动时需要加载的代码体积。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "FORAMOREDETAILEDDISCUSSIONSEEINTRODUCTIONTOMODULESGUIDEARCHITECTUREMODULES", - "original": "For a more detailed discussion, see [Introduction to modules](guide/architecture-modules).", - "translation": "更深入的套路,参见[模块简介](guide/architecture-modules)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "##COMPONENTS", - "original": "## Components", - "translation": "## 组件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "EVERYANGULARAPPLICATIONHASATLEASTONECOMPONENTTHEROOTCOMPONENTTHATCONNECTSACOMPONENTHIERARCHYWITHTHEPAGEDOMEACHCOMPONENTDEFINESACLASSTHATCONTAINSAPPLICATIONDATAANDLOGICANDISASSOCIATEDWITHANHTMLTEMPLATETHATDEFINESAVIEWTOBEDISPLAYEDINATARGETENVIRONMENT", - "original": "Every Angular application has at least one component, the *root component* that connects a component hierarchy with the page DOM. Each component defines a class that contains application data and logic, and is associated with an HTML *template* that defines a view to be displayed in a target environment.", - "translation": "每个 Angular 应用都至少有一个组件,也就是*根组件*,它会把组件树和页面中的 DOM 连接起来。\n每个组件都会定义一个类,其中包含应用的数据和逻辑,并与一个 HTML *模板*相关联,该模板定义了一个供目标环境下显示的视图。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "THECOMPONENTDECORATORIDENTIFIESTHECLASSIMMEDIATELYBELOWITASACOMPONENTANDPROVIDESTHETEMPLATEANDRELATEDCOMPONENTSPECIFICMETADATA", - "original": "The `@Component` decorator identifies the class immediately below it as a component, and provides the template and related component-specific metadata.", - "translation": "`@Component` 装饰器表明紧随它的那个类是一个组件,并提供模板和该组件专属的元数据。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "DECORATORSAREFUNCTIONSTHATMODIFYJAVASCRIPTCLASSESANGULARDEFINESANUMBEROFSUCHDECORATORSTHATATTACHSPECIFICKINDSOFMETADATATOCLASSESSOTHATITKNOWSWHATTHOSECLASSESMEANANDHOWTHEYSHOULDWORK", - "original": "Decorators are functions that modify JavaScript classes. Angular defines a number of such decorators that attach specific kinds of metadata to classes, so that it knows what those classes mean and how they should work.", - "translation": "装饰器是一些用于修饰 JavaScript 类的函数。Angular 定义了许多装饰器,这些装饰器会把一些特定种类的元数据附加到类上,以便 Angular 了解这些这些类的含义以及该如何使用它们。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "AHREFHTTPS:MEDIUMCOMGOOGLEDEVELOPERSEXPLORINGES7DECORATORS76ECB65FB841#X5C2NDTX0LEARNMOREABOUTDECORATORSONTHEWEBA", - "original": "Learn more about decorators on the web.", - "translation": "到网上学习关于装饰器的更多知识。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "###TEMPLATESDIRECTIVESANDDATABINDING", - "original": "### Templates, directives, and data binding", - "translation": "### 模板、指令和数据绑定", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "ATEMPLATECOMBINESHTMLWITHANGULARMARKUPTHATCANMODIFYTHEHTMLELEMENTSBEFORETHEYAREDISPLAYEDTEMPLATEDIRECTIVESPROVIDEPROGRAMLOGICANDBINDINGMARKUPCONNECTSYOURAPPLICATIONDATAANDTHEDOCUMENTOBJECTMODELDOM", - "original": "A template combines HTML with Angular markup that can modify the HTML elements before they are displayed.\nTemplate *directives* provide program logic, and *binding markup* connects your application data and the document object model (DOM).", - "translation": "模板会把 HTML 和 Angular 的标记(markup)组合起来,这些标记可以在 HTML 元素显示出来之前修改它们。\n模板中的*指令*会提供程序逻辑,而*绑定标记*会把你应用中的数据和 DOM 连接在一起。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "EVENTBINDINGLETSYOURAPPRESPONDTOUSERINPUTINTHETARGETENVIRONMENTBYUPDATINGYOURAPPLICATIONDATA", - "original": "* *Event binding* lets your app respond to user input in the target environment by updating your application data.", - "translation": "*事件绑定*让你的应用可以通过更新应用的数据来响应目标环境下的用户输入。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "PROPERTYBINDINGLETSYOUINTERPOLATEVALUESTHATARECOMPUTEDFROMYOURAPPLICATIONDATAINTOTHEHTML", - "original": "* *Property binding* lets you interpolate values that are computed from your application data into the HTML.", - "translation": "*属性绑定*让你将从应用数据中计算出来的值插入到 HTML 中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "BEFOREAVIEWISDISPLAYEDANGULAREVALUATESTHEDIRECTIVESANDRESOLVESTHEBINDINGSYNTAXINTHETEMPLATETOMODIFYTHEHTMLELEMENTSANDTHEDOMACCORDINGTOYOURPROGRAMDATAANDLOGICANGULARSUPPORTSTWOWAYDATABINDINGMEANINGTHATCHANGESINTHEDOMSUCHASUSERCHOICESCANALSOBEREFLECTEDBACKINTOYOURPROGRAMDATA", - "original": "Before a view is displayed, Angular evaluates the directives and resolves the binding syntax in the template to modify the HTML elements and the DOM, according to your program data and logic. Angular supports *two-way data binding*, meaning that changes in the DOM, such as user choices, can also be reflected back into your program data.", - "translation": "在视图显示出来之前,Angular 会先根据你的应用数据和逻辑来运行模板中的指令并解析绑定表达式,以修改 HTML 元素和 DOM。\nAngular 支持*双向数据绑定*,这意味着 DOM 中发生的变化(比如用户的选择)同样可以反映回你的程序数据中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "YOURTEMPLATESCANALSOUSEPIPESTOIMPROVETHEUSEREXPERIENCEBYTRANSFORMINGVALUESFORDISPLAYUSEPIPESTODISPLAYFOREXAMPLEDATESANDCURRENCYVALUESINAWAYAPPROPRIATETOTHEUSERSLOCALEANGULARPROVIDESPREDEFINEDPIPESFORCOMMONTRANSFORMATIONSANDYOUCANALSODEFINEYOUROWN", - "original": "Your templates can also use *pipes* to improve the user experience by transforming values for display. Use pipes to display, for example, dates and currency values in a way appropriate to the user's locale. Angular provides predefined pipes for common transformations, and you can also define your own.", - "translation": "你的模板也可以用*管道*转换要显示的值以增强用户体验。比如,可以使用管道来显示适合用户所在地区的日期和货币格式。\nAngular 为一些通用的转换提供了预定义管道,你还可以定义自己的管道。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "FORAMOREDETAILEDDISCUSSIONOFTHESECONCEPTSSEEINTRODUCTIONTOCOMPONENTSGUIDEARCHITECTURECOMPONENTS", - "original": "For a more detailed discussion of these concepts, see [Introduction to components](guide/architecture-components).", - "translation": "要了解对这些概念的深入讨论,参见[组件介绍](guide/architecture-components)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "##SERVICESANDDEPENDENCYINJECTION", - "original": "## Services and dependency injection", - "translation": "## 服务于依赖注入", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "FORDATAORLOGICTHATISNOTASSOCIATEDWITHASPECIFICVIEWANDTHATYOUWANTTOSHAREACROSSCOMPONENTSYOUCREATEASERVICECLASSASERVICECLASSDEFINITIONISIMMEDIATELYPRECEDEDBYTHEINJECTABLEDECORATORTHEDECORATORPROVIDESTHEMETADATATHATALLOWSYOURSERVICETOBEINJECTEDINTOCLIENTCOMPONENTSASADEPENDENCY", - "original": "For data or logic that is not associated with a specific view, and that you want to share across components, you create a *service* class. A service class definition is immediately preceded by the `@Injectable` decorator. The decorator provides the metadata that allows your service to be *injected* into client components as a dependency.", - "translation": "对于与特定视图无关并希望跨组件共享的数据或逻辑,可以创建*服务*类。\n服务类的定义通常紧跟在 “@Injectable” 装饰器之后。该装饰器提供的元数据可以让你的服务作为依赖*被注入到*客户组件中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "DEPENDENCYINJECTIONORDILETSYOUKEEPYOURCOMPONENTCLASSESLEANANDEFFICIENTTHEYDONTFETCHDATAFROMTHESERVERVALIDATEUSERINPUTORLOGDIRECTLYTOTHECONSOLETHEYDELEGATESUCHTASKSTOSERVICES", - "original": "*Dependency injection* (or DI) lets you keep your component classes lean and efficient. They don't fetch data from the server, validate user input, or log directly to the console; they delegate such tasks to services.", - "translation": "*依赖注入*(或 DI)让你可以保持组件类的精简和高效。有了 DI,组件就不用从服务器获取数据、验证用户输入或直接把日志写到控制台,而是会把这些任务委托给服务。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "FORAMOREDETAILEDDISCUSSSIONSEEINTRODUCTIONTOSERVICESANDDIGUIDEARCHITECTURESERVICES", - "original": "For a more detailed discusssion, see [Introduction to services and DI](guide/architecture-services).", - "translation": "更深入的讨论,参见[服务和 DI 简介](guide/architecture-services)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "###ROUTING", - "original": "### Routing", - "translation": "### 路由", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "THEANGULARROUTERNGMODULEPROVIDESASERVICETHATLETSYOUDEFINEANAVIGATIONPATHAMONGTHEDIFFERENTAPPLICATIONSTATESANDVIEWHIERARCHIESINYOURAPPITISMODELEDONTHEFAMILIARBROWSERNAVIGATIONCONVENTIONS:", - "original": "The Angular `Router` NgModule provides a service that lets you define a navigation path among the different application states and view hierarchies in your app. It is modeled on the familiar browser navigation conventions:", - "translation": "Angular 的 `Router` 模块提供了一个服务,它可以让你定义在应用的各个不同状态和视图层次结构之间导航时要使用的路径。\n它的工作模型基于人们熟知的浏览器导航约定:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "ENTERAURLINTHEADDRESSBARANDTHEBROWSERNAVIGATESTOACORRESPONDINGPAGE", - "original": "* Enter a URL in the address bar and the browser navigates to a corresponding page.", - "translation": "在地址栏输入 URL,浏览器就会导航到相应的页面。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "CLICKLINKSONTHEPAGEANDTHEBROWSERNAVIGATESTOANEWPAGE", - "original": "* Click links on the page and the browser navigates to a new page.", - "translation": "在页面中点击链接,浏览器就会导航到一个新页面。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "CLICKTHEBROWSERSBACKANDFORWARDBUTTONSANDTHEBROWSERNAVIGATESBACKWARDANDFORWARDTHROUGHTHEHISTORYOFPAGESYOUVESEEN", - "original": "* Click the browser's back and forward buttons and the browser navigates backward and forward through the history of pages you've seen.", - "translation": "点击浏览器的前进和后退按钮,浏览器就会在你的浏览历史中向前或向后导航。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "THEROUTERMAPSURLLIKEPATHSTOVIEWSINSTEADOFPAGESWHENAUSERPERFORMSANACTIONSUCHASCLICKINGALINKTHATWOULDLOADANEWPAGEINTHEBROWSERTHEROUTERINTERCEPTSTHEBROWSERSBEHAVIORANDSHOWSORHIDESVIEWHIERARCHIES", - "original": "The router maps URL-like paths to views instead of pages. When a user performs an action, such as clicking a link, that would load a new page in the browser, the router intercepts the browser's behavior, and shows or hides view hierarchies.", - "translation": "不过路由器会把类似 URL 的路径映射到视图而不是页面。\n当用户执行一个动作时(比如点击链接),本应该在浏览器中加载一个新页面,但是路由器拦截了浏览器的这个行为,并显示或隐藏一个视图层次结构。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "IFTHEROUTERDETERMINESTHATTHECURRENTAPPLICATIONSTATEREQUIRESPARTICULARFUNCTIONALITYANDTHEMODULETHATDEFINESITHASNOTBEENLOADEDTHEROUTERCANLAZYLOADTHEMODULEONDEMAND", - "original": "If the router determines that the current application state requires particular functionality, and the module that defines it has not been loaded, the router can _lazy-load_ the module on demand.", - "translation": "如果路由器认为当前的应用状态需要某些特定的功能,而定义此功能的模块尚未加载,路由器就会按需*惰性加载*此模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "THEROUTERINTERPRETSALINKURLACCORDINGTOYOURAPPSVIEWNAVIGATIONRULESANDDATASTATEYOUCANNAVIGATETONEWVIEWSWHENTHEUSERCLICKSABUTTONSELECTSFROMADROPBOXORINRESPONSETOSOMEOTHERSTIMULUSFROMANYSOURCETHEROUTERLOGSACTIVITYINTHEBROWSERSHISTORYJOURNALSOTHEBACKANDFORWARDBUTTONSWORKASWELL", - "original": "The router interprets a link URL according to your app's view navigation rules and data state. You can navigate to new views when the user clicks a button, selects from a drop box, or in response to some other stimulus from any source. The Router logs activity in the browser's history journal, so the back and forward buttons work as well.", - "translation": "路由器会根据你应用中的导航规则和数据状态来拦截 URL。\n当用户点击按钮、选择下拉框或收到其它任何来源的输入时,你可以导航到一个新视图。\n路由器会在浏览器的历史日志中记录这个动作,所以前进和后退按钮也能正常工作。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "TODEFINENAVIGATIONRULESYOUASSOCIATENAVIGATIONPATHSWITHYOURCOMPONENTSAPATHUSESAURLLIKESYNTAXTHATINTEGRATESYOURPROGRAMDATAINMUCHTHESAMEWAYTHATTEMPLATESYNTAXINTEGRATESYOURVIEWSWITHYOURPROGRAMDATAYOUCANTHENAPPLYPROGRAMLOGICTOCHOOSEWHICHVIEWSTOSHOWORTOHIDEINRESPONSETOUSERINPUTANDYOUROWNACCESSRULES", - "original": "To define navigation rules, you associate *navigation paths* with your components. A path uses a URL-like syntax that integrates your program data, in much the same way that template syntax integrates your views with your program data. You can then apply program logic to choose which views to show or to hide, in response to user input and your own access rules.", - "translation": "要定义导航规则,你就要把*导航路径*和你的组件关联起来。\n路径(path)使用类似 URL 的语法来和程序数据整合在一起,就像模板语法会把你的视图和程序数据整合起来一样。\n然后你就可以用程序逻辑来决定要显示或隐藏哪些视图,以根据你制定的访问规则对用户的输入做出响应。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "FORAMOREDETAILEDDISCUSSIONSEEROUTINGANDNAVIGATIONGUIDEROUTER", - "original": "For a more detailed discussion, see [Routing and navigation](guide/router).", - "translation": "更深入的讨论,参见[路由与导航](guide/router)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "##WHATSNEXT", - "original": "## What's next", - "translation": "## 接下来呢?", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "YOUVELEARNEDTHEBASICSABOUTTHEMAINBUILDINGBLOCKSOFANANGULARAPPLICATIONTHEFOLLOWINGDIAGRAMSHOWSHOWTHESEBASICPIECESARERELATED", - "original": "You've learned the basics about the main building blocks of an Angular application. The following diagram shows how these basic pieces are related.", - "translation": "你已经学完了 Angular 应用的主要构造块的基础知识。\n下面这张图展示了这些基础部分之间是如何关联起来的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "TOGETHERACOMPONENTANDTEMPLATEDEFINEANANGULARVIEW", - "original": "* Together, a component and template define an Angular view.", - "translation": "组件和模板共同定义了 Angular 的视图。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "ADECORATORONACOMPONENTCLASSADDSTHEMETADATAINCLUDINGAPOINTERTOTHEASSOCIATEDTEMPLATE", - "original": "* A decorator on a component class adds the metadata, including a pointer to the associated template.", - "translation": "组件类上的装饰器为其添加了元数据,其中包括指向相关模板的指针。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "DIRECTIVESANDBINDINGMARKUPINACOMPONENTSTEMPLATEMODIFYVIEWSBASEDONPROGRAMDATAANDLOGIC", - "original": "* Directives and binding markup in a component's template modify views based on program data and logic.", - "translation": "组件模板中的指令和绑定标记会根据程序数据和程序逻辑修改这些视图。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "THEDEPENDENCYINJECTORPROVIDESSERVICESTOACOMPONENTSUCHASTHEROUTERSERVICETHATLETSYOUDEFINENAVIGATIONAMONGVIEWS", - "original": "* The dependency injector provides services to a component, such as the router service that lets you define navigation among views.", - "translation": "依赖注入器会为组件提供一些服务,比如路由器服务就能让你定义如何在视图之间导航。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "EACHOFTHESESUBJECTSISINTRODUCEDINMOREDETAILINTHEFOLLOWINGPAGES", - "original": "Each of these subjects is introduced in more detail in the following pages.", - "translation": "这些主题的详情在下列页面中有介绍:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "MODULESGUIDEARCHITECTUREMODULES", - "original": "* [Modules](guide/architecture-modules)", - "translation": "[模块](guide/architecture-modules)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "COMPONENTSGUIDEARCHITECTURECOMPONENTS", - "original": "* [Components](guide/architecture-components)", - "translation": "[组件](guide/architecture-components)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "TEMPLATESGUIDEARCHITECTURECOMPONENTS#TEMPLATESANDVIEWS", - "original": "* [Templates](guide/architecture-components#templates-and-views)", - "translation": "[模板](guide/architecture-components#templates-and-views)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "METADATAGUIDEARCHITECTURECOMPONENTS#COMPONENTMETADATA", - "original": "* [Metadata](guide/architecture-components#component-metadata)", - "translation": "[元数据](guide/architecture-components#component-metadata)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "DATABINDINGGUIDEARCHITECTURECOMPONENTS#DATABINDING", - "original": "* [Data binding](guide/architecture-components#data-binding)", - "translation": "[绑定](guide/architecture-components#data-binding)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "DIRECTIVESGUIDEARCHITECTURECOMPONENTS#DIRECTIVES", - "original": "* [Directives](guide/architecture-components#directives)", - "translation": "[指令](guide/architecture-components#directives)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "PIPESGUIDEARCHITECTURECOMPONENTS#PIPES", - "original": "* [Pipes](guide/architecture-components#pipes)", - "translation": "[管道](guide/architecture-components#pipes)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "SERVICESANDDEPENDENCYINJECTIONGUIDEARCHITECTURESERVICES", - "original": "* [Services and dependency injection](guide/architecture-services)", - "translation": "[服务于依赖注入](guide/architecture-services)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "NOTETHATTHECODEREFERENCEDONTHESEPAGESISAVAILABLEASALIVEEXAMPLELIVEEXAMPLE", - "original": "Note that the code referenced on these pages is available as a .", - "translation": "注意,这些页面中的代码都在中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "WHENYOUAREFAMILIARWITHTHESEFUNDAMENTALBUILDINGBLOCKSYOUCANEXPLORETHEMINMOREDETAILINTHEDOCUMENTATIONTOLEARNABOUTMORETOOLSANDTECHNIQUESTHATAREAVAILABLETOHELPYOUBUILDANDDEPLOYANGULARAPPLICATIONSSEENEXTSTEPSGUIDEARCHITECTURENEXTSTEPS", - "original": "When you are familiar with these fundamental building blocks, you can explore them in more detail in the documentation. To learn about more tools and techniques that are available to help you build and deploy Angular applications, see [Next steps](guide/architecture-next-steps).", - "translation": "当你熟悉了这些基础构造块之后,就可以在本文档中进一步查看它们的详情了。\n要学习能帮你构建和发布应用的更多工具和技巧,参见[后续步骤](guide/architecture-next-steps)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture.md" - }, - { - "key": "#ATTRIBUTEDIRECTIVES", - "original": "# Attribute Directives", - "translation": "# 属性型指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ANATTRIBUTEDIRECTIVECHANGESTHEAPPEARANCEORBEHAVIOROFADOMELEMENT", - "original": "An **Attribute** directive changes the appearance or behavior of a DOM element.", - "translation": "**属性**型指令用于改变一个 DOM 元素的外观或行为。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "TRYTHELIVEEXAMPLETITLEATTRIBUTEDIRECTIVEEXAMPLELIVEEXAMPLE", - "original": "Try the .", - "translation": "你可以到这里试试:。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "##DIRECTIVESOVERVIEW", - "original": "## Directives overview", - "translation": "## 指令概览", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEREARETHREEKINDSOFDIRECTIVESINANGULAR:", - "original": "There are three kinds of directives in Angular:", - "translation": "在 Angular 中有三种类型的指令:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "1COMPONENTSMDASHDIRECTIVESWITHATEMPLATE", - "original": "1. Components—directives with a template.", - "translation": "组件 — 拥有模板的指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "1STRUCTURALDIRECTIVESMDASHCHANGETHEDOMLAYOUTBYADDINGANDREMOVINGDOMELEMENTS", - "original": "1. Structural directives—change the DOM layout by adding and removing DOM elements.", - "translation": "结构型指令 — 通过添加和移除 DOM 元素改变 DOM 布局的指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "1ATTRIBUTEDIRECTIVESMDASHCHANGETHEAPPEARANCEORBEHAVIOROFANELEMENTCOMPONENTORANOTHERDIRECTIVE", - "original": "1. Attribute directives—change the appearance or behavior of an element, component, or another directive.", - "translation": "属性型指令 — 改变元素、组件或其它指令的外观和行为的指令。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "COMPONENTSARETHEMOSTCOMMONOFTHETHREEDIRECTIVESYOUSAWACOMPONENTFORTHEFIRSTTIMEINTHEQUICKSTARTGUIDEQUICKSTARTGUIDE", - "original": "*Components* are the most common of the three directives.\nYou saw a component for the first time in the [QuickStart](guide/quickstart) guide.", - "translation": "*组件*是这三种指令中最常用的。\n你在[快速上手](guide/quickstart)例子中第一次见到组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "STRUCTURALDIRECTIVESCHANGETHESTRUCTUREOFTHEVIEWTWOEXAMPLESARENGFORGUIDETEMPLATESYNTAX#NGFORANDNGIFGUIDETEMPLATESYNTAX#NGIFLEARNABOUTTHEMINTHESTRUCTURALDIRECTIVESGUIDESTRUCTURALDIRECTIVESGUIDE", - "original": "*Structural Directives* change the structure of the view.\nTwo examples are [NgFor](guide/template-syntax#ngFor) and [NgIf](guide/template-syntax#ngIf).\nLearn about them in the [Structural Directives](guide/structural-directives) guide.", - "translation": "*结构型*指令修改视图的结构。例如,[NgFor](guide/template-syntax#ngFor) 和 [NgIf](guide/template-syntax#ngIf)。\n要了解更多,参见[结构型指令](guide/structural-directives) guide。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ATTRIBUTEDIRECTIVESAREUSEDASATTRIBUTESOFELEMENTSTHEBUILTINNGSTYLEGUIDETEMPLATESYNTAX#NGSTYLEDIRECTIVEINTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXGUIDEFOREXAMPLECANCHANGESEVERALELEMENTSTYLESATTHESAMETIME", - "original": "*Attribute directives* are used as attributes of elements.\nThe built-in [NgStyle](guide/template-syntax#ngStyle) directive in the\n[Template Syntax](guide/template-syntax) guide, for example,\ncan change several element styles at the same time.", - "translation": "*属性型*指令改变一个元素的外观或行为。例如,内置的 [NgStyle](guide/template-syntax#ngStyle) 指令可以同时修改元素的多个样式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "##BUILDASIMPLEATTRIBUTEDIRECTIVE", - "original": "## Build a simple attribute directive", - "translation": "## 创建一个简单的属性型指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ANATTRIBUTEDIRECTIVEMINIMALLYREQUIRESBUILDINGACONTROLLERCLASSANNOTATEDWITHDIRECTIVEWHICHSPECIFIESTHESELECTORTHATIDENTIFIESTHEATTRIBUTETHECONTROLLERCLASSIMPLEMENTSTHEDESIREDDIRECTIVEBEHAVIOR", - "original": "An attribute directive minimally requires building a controller class annotated with\n`@Directive`, which specifies the selector that identifies\nthe attribute.\nThe controller class implements the desired directive behavior.", - "translation": "属性型指令至少需要一个带有 `@Directive` 装饰器的控制器类。该装饰器指定了一个用于标识属性的选择器。\n控制器类实现了指令需要的指令行为。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THISPAGEDEMONSTRATESBUILDINGASIMPLEAPPHIGHLIGHTATTRIBUTEDIRECTIVETOSETANELEMENTSBACKGROUNDCOLORWHENTHEUSERHOVERSOVERTHATELEMENTYOUCANAPPLYITLIKETHIS:", - "original": "This page demonstrates building a simple _appHighlight_ attribute\ndirective to set an element's background color\nwhen the user hovers over that element. You can apply it like this:", - "translation": "本章展示了如何创建一个简单的属性型指令 _myHighlight_ ,当用户把鼠标悬停在一个元素上时,改变它的背景色。你可以这样用它:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "###WRITETHEDIRECTIVECODE", - "original": "### Write the directive code", - "translation": "### 编写指令代码", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "CREATETHEDIRECTIVECLASSFILEINATERMINALWINDOWWITHTHISCLICOMMAND", - "original": "Create the directive class file in a terminal window with this CLI command.", - "translation": "在命令行窗口下用 CLI 命令创建指令类文件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THECLICREATESSRCAPPHIGHLIGHTDIRECTIVETSACORRESPONDINGTESTFILESPECTSANDDECLARESTHEDIRECTIVECLASSINTHEROOTAPPMODULE", - "original": "The CLI creates `src/app/highlight.directive.ts`, a corresponding test file (`.../spec.ts`, and _declares_ the directive class in the root `AppModule`.", - "translation": "CLI 会创建 `src/app/highlight.directive.ts` 及相应的测试文件(`.../spec.ts`),并且在根模块 `AppModule` 中声明这个指令类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "DIRECTIVESMUSTBEDECLAREDINANGULARMODULESGUIDENGMODULESINTHESAMEMANNERASCOMPONENTS", - "original": "_Directives_ must be declared in [Angular Modules](guide/ngmodules) in the same manner as _components_.", - "translation": "和**组件**一样,这些**指令**也必须在[Angular 模块](guide/ngmodules)中进行声明。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEGENERATEDSRCAPPHIGHLIGHTDIRECTIVETSISASFOLLOWS:", - "original": "The generated `src/app/highlight.directive.ts` is as follows:", - "translation": "生成的 `src/app/highlight.directive.ts` 文件如下:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEIMPORTEDDIRECTIVESYMBOLPROVIDESTHEANGULARTHEDIRECTIVEDECORATOR", - "original": "The imported `Directive` symbol provides the Angular the `@Directive` decorator.", - "translation": "这里导入的 `Directive` 符号提供了 Angular 的 `@Directive` 装饰器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEDIRECTIVEDECORATORSLONECONFIGURATIONPROPERTYSPECIFIESTHEDIRECTIVESCSSATTRIBUTESELECTORHTTPS:DEVELOPERMOZILLAORGENUSDOCSWEBCSSATTRIBUTESELECTORSAPPHIGHLIGHT", - "original": "The `@Directive` decorator's lone configuration property specifies the directive's\n[CSS attribute selector](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors), `[appHighlight]`.", - "translation": "`@Directive` 装饰器的配置属性中指定了该指令的 [CSS 属性型选择器](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) `[appHighlight]`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ITSTHEBRACKETSTHATMAKEITANATTRIBUTESELECTORANGULARLOCATESEACHELEMENTINTHETEMPLATETHATHASANATTRIBUTENAMEDAPPHIGHLIGHTANDAPPLIESTHELOGICOFTHISDIRECTIVETOTHATELEMENT", - "original": "It's the brackets (`[]`) that make it an attribute selector.\nAngular locates each element in the template that has an attribute named `appHighlight` and applies the logic of this directive to that element.", - "translation": "这里的方括号(`[]`)表示它的属性型选择器。\nAngular 会在模板中定位每个名叫 `appHighlight` 的元素,并且为这些元素加上本指令的逻辑。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEATTRIBUTESELECTORPATTERNEXPLAINSTHENAMEOFTHISKINDOFDIRECTIVE", - "original": "The _attribute selector_ pattern explains the name of this kind of directive.", - "translation": "正因如此,这类指令被称为 **属性选择器** 。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "####WHYNOTHIGHLIGHT", - "original": "#### Why not \"highlight\"?", - "translation": "#### 为什么不直接叫做 \"highlight\"?", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THOUGHHIGHLIGHTWOULDBEAMORECONCISESELECTORTHANAPPHIGHLIGHTANDITWOULDWORKTHEBESTPRACTICEISTOPREFIXSELECTORNAMESTOENSURETHEYDONTCONFLICTWITHSTANDARDHTMLATTRIBUTESTHISALSOREDUCESTHERISKOFCOLLIDINGWITHTHIRDPARTYDIRECTIVENAMESTHECLIADDEDTHEAPPPREFIXFORYOU", - "original": "Though *highlight* would be a more concise selector than *appHighlight* and it would work,\nthe best practice is to prefix selector names to ensure\nthey don't conflict with standard HTML attributes.\nThis also reduces the risk of colliding with third-party directive names.\nThe CLI added the `app` prefix for you.", - "translation": "尽管 *highlight* 是一个比 *myHighlight* 更简洁的名字,而且它确实也能工作。\n但是最佳实践是在选择器名字前面添加前缀,以确保它们不会与标准 HTML 属性冲突。\n它同时减少了与第三方指令名字发生冲突的危险。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "MAKESUREYOUDONOTPREFIXTHEHIGHLIGHTDIRECTIVENAMEWITHNGBECAUSETHATPREFIXISRESERVEDFORANGULARANDUSINGITCOULDCAUSEBUGSTHATAREDIFFICULTTODIAGNOSE", - "original": "Make sure you do **not** prefix the `highlight` directive name with **`ng`** because\nthat prefix is reserved for Angular and using it could cause bugs that are difficult to diagnose.", - "translation": "确认你**没有**给 `highlight` 指令添加**`ng`**前缀。\n那个前缀属于 Angular,使用它可能导致难以诊断的 bug。例如,这个简短的前缀 `my` 可以帮助你区分自定义指令。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "AFTERTHEDIRECTIVEMETADATACOMESTHEDIRECTIVESCONTROLLERCLASSCALLEDHIGHLIGHTDIRECTIVEWHICHCONTAINSTHECURRENTLYEMPTYLOGICFORTHEDIRECTIVEEXPORTINGHIGHLIGHTDIRECTIVEMAKESTHEDIRECTIVEACCESSIBLE", - "original": "After the `@Directive` metadata comes the directive's controller class,\ncalled `HighlightDirective`, which contains the (currently empty) logic for the directive.\nExporting `HighlightDirective` makes the directive accessible.", - "translation": "紧跟在 `@Directive` 元数据之后的就是该指令的控制器类,名叫 `HighlightDirective`,它包含了该指令的逻辑(目前为空逻辑)。然后导出 `HighlightDirective`,以便它能在别处访问到。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "NOWEDITTHEGENERATEDSRCAPPHIGHLIGHTDIRECTIVETSTOLOOKASFOLLOWS:", - "original": "Now edit the generated `src/app/highlight.directive.ts` to look as follows:", - "translation": "现在,把刚才生成的 `src/app/highlight.directive.ts` 编辑成这样:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEIMPORTSTATEMENTSPECIFIESANADDITIONALELEMENTREFSYMBOLFROMTHEANGULARCORELIBRARY:", - "original": "The `import` statement specifies an additional `ElementRef` symbol from the Angular `core` library:", - "translation": "`import` 语句还从 Angular 的 `core` 库中导入了一个 `ElementRef` 符号。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "YOUUSETHEELEMENTREFINTHEDIRECTIVESCONSTRUCTORTOINJECTGUIDEDEPENDENCYINJECTIONAREFERENCETOTHEHOSTDOMELEMENTTHEELEMENTTOWHICHYOUAPPLIEDAPPHIGHLIGHT", - "original": "You use the `ElementRef`in the directive's constructor\nto [inject](guide/dependency-injection) a reference to the host DOM element, \nthe element to which you applied `appHighlight`.", - "translation": "你可以在指令的构造函数中注入 `ElementRef`,来引用宿主 DOM 元素,", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ELEMENTREFGRANTSDIRECTACCESSTOTHEHOSTDOMELEMENTTHROUGHITSNATIVEELEMENTPROPERTY", - "original": "`ElementRef` grants direct access to the host DOM element\nthrough its `nativeElement` property.", - "translation": "`ElementRef` 通过其 `nativeElement` 属性给你了直接访问宿主 DOM 元素的能力。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THISFIRSTIMPLEMENTATIONSETSTHEBACKGROUNDCOLOROFTHEHOSTELEMENTTOYELLOW", - "original": "This first implementation sets the background color of the host element to yellow.", - "translation": "这里的第一个实现把宿主元素的背景色设置为了黄色。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "##APPLYTHEATTRIBUTEDIRECTIVE", - "original": "## Apply the attribute directive", - "translation": "## 使用属性型指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "TOUSETHENEWHIGHLIGHTDIRECTIVEADDAPARAGRAPHPELEMENTTOTHETEMPLATEOFTHEROOTAPPCOMPONENTANDAPPLYTHEDIRECTIVEASANATTRIBUTE", - "original": "To use the new `HighlightDirective`, add a paragraph (`

    `) element to the template of the root `AppComponent` and apply the directive as an attribute.", - "translation": "要想使用这个新的 `HighlightDirective`,就往根组件 `AppComponent` 的模板中添加一个 `

    ` 元素,并把该指令作为一个属性使用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "NOWRUNTHEAPPLICATIONTOSEETHEHIGHLIGHTDIRECTIVEINACTION", - "original": "Now run the application to see the `HighlightDirective` in action.", - "translation": "运行这个应用以查看 `HighlightDirective` 的实际效果。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "TOSUMMARIZEANGULARFOUNDTHEAPPHIGHLIGHTATTRIBUTEONTHEHOSTPELEMENTITCREATEDANINSTANCEOFTHEHIGHLIGHTDIRECTIVECLASSANDINJECTEDAREFERENCETOTHEPELEMENTINTOTHEDIRECTIVESCONSTRUCTORWHICHSETSTHEPELEMENTSBACKGROUNDSTYLETOYELLOW", - "original": "To summarize, Angular found the `appHighlight` attribute on the **host** `

    ` element.\nIt created an instance of the `HighlightDirective` class and\ninjected a reference to the `

    ` element into the directive's constructor\nwhich sets the `

    ` element's background style to yellow.", - "translation": "总结:Angular 在**宿主**元素 `

    ` 上发现了一个 `appHighlight` 属性。\n然后它创建了一个 `HighlightDirective` 类的实例,并把所在元素的引用注入到了指令的构造函数中。\n在构造函数中,该指令把 `

    ` 元素的背景设置为了黄色。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "##RESPONDTOUSERINITIATEDEVENTS", - "original": "## Respond to user-initiated events", - "translation": "## 响应用户引发的事件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "CURRENTLYAPPHIGHLIGHTSIMPLYSETSANELEMENTCOLORTHEDIRECTIVECOULDBEMOREDYNAMICITCOULDDETECTWHENTHEUSERMOUSESINTOOROUTOFTHEELEMENTANDRESPONDBYSETTINGORCLEARINGTHEHIGHLIGHTCOLOR", - "original": "Currently, `appHighlight` simply sets an element color.\nThe directive could be more dynamic.\nIt could detect when the user mouses into or out of the element\nand respond by setting or clearing the highlight color.", - "translation": "当前,`appHighlight` 只是简单的设置元素的颜色。\n这个指令应该在用户鼠标悬浮一个元素时,设置它的颜色。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "BEGINBYADDINGHOSTLISTENERTOTHELISTOFIMPORTEDSYMBOLS", - "original": "Begin by adding `HostListener` to the list of imported symbols.", - "translation": "先把 `HostListener` 加进导入列表中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THENADDTWOEVENTHANDLERSTHATRESPONDWHENTHEMOUSEENTERSORLEAVESEACHADORNEDBYTHEHOSTLISTENERDECORATOR", - "original": "Then add two eventhandlers that respond when the mouse enters or leaves,\neach adorned by the `HostListener` decorator.", - "translation": "然后使用 `HostListener` 装饰器添加两个事件处理器,它们会在鼠标进入或离开时进行响应。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEHOSTLISTENERDECORATORLETSYOUSUBSCRIBETOEVENTSOFTHEDOMELEMENTTHATHOSTSANATTRIBUTEDIRECTIVETHEPINTHISCASE", - "original": "The `@HostListener` decorator lets you subscribe to events of the DOM\nelement that hosts an attribute directive, the `

    ` in this case.", - "translation": "`@HostListener` 装饰器引用属性型指令的宿主元素,在这个例子中就是 `

    `。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "OFCOURSEYOUCOULDREACHINTOTHEDOMWITHSTANDARDJAVASCRIPTANDATTACHEVENTLISTENERSMANUALLYTHEREAREATLEASTTHREEPROBLEMSWITHTHATAPPROACH:", - "original": "Of course you could reach into the DOM with standard JavaScript and attach event listeners manually.\nThere are at least three problems with _that_ approach:", - "translation": "当然,你可以通过标准的 JavaScript 方式手动给宿主 DOM 元素附加一个事件监听器。\n但这种方法至少有三个问题:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "1YOUHAVETOWRITETHELISTENERSCORRECTLY", - "original": "1. You have to write the listeners correctly.", - "translation": "必须正确的书写事件监听器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "1THECODEMUSTDETACHTHELISTENERWHENTHEDIRECTIVEISDESTROYEDTOAVOIDMEMORYLEAKS", - "original": "1. The code must *detach* the listener when the directive is destroyed to avoid memory leaks.", - "translation": "当指令被销毁的时候,必须*拆卸*事件监听器,否则会导致内存泄露。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "1TALKINGTODOMAPIDIRECTLYISNTABESTPRACTICE", - "original": "1. Talking to DOM API directly isn't a best practice.", - "translation": "必须直接和 DOM API 打交道,应该避免这样做。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEHANDLERSDELEGATETOAHELPERMETHODTHATSETSTHECOLORONTHEHOSTDOMELEMENTEL", - "original": "The handlers delegate to a helper method that sets the color on the host DOM element, `el`.", - "translation": "这些处理器委托了一个辅助方法来为 DOM 元素(`el`)设置颜色。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEHELPERMETHODHIGHLIGHTWASEXTRACTEDFROMTHECONSTRUCTORTHEREVISEDCONSTRUCTORSIMPLYDECLARESTHEINJECTEDEL:ELEMENTREF", - "original": "The helper method, `highlight`, was extracted from the constructor.\nThe revised constructor simply declares the injected `el: ElementRef`.", - "translation": "这个辅助方法(`highlight`)被从构造函数中提取了出来。\n修改后的构造函数只负责声明要注入的元素 `el: ElementRef`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "HERESTHEUPDATEDDIRECTIVEINFULL:", - "original": "Here's the updated directive in full:", - "translation": "下面是修改后的指令代码:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "RUNTHEAPPANDCONFIRMTHATTHEBACKGROUNDCOLORAPPEARSWHENTHEMOUSEHOVERSOVERTHEPANDDISAPPEARSASITMOVESOUT", - "original": "Run the app and confirm that the background color appears when\nthe mouse hovers over the `p` and disappears as it moves out.", - "translation": "运行本应用并确认:当把鼠标移到 `p` 上的时候,背景色就出现了,而移开的时候,它消失了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "##PASSVALUESINTOTHEDIRECTIVEWITHANINPUTDATABINDING", - "original": "## Pass values into the directive with an _@Input_ data binding", - "translation": "## 使用 `@Input` 数据绑定向指令传递值", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "CURRENTLYTHEHIGHLIGHTCOLORISHARDCODEDWITHINTHEDIRECTIVETHATSINFLEXIBLEINTHISSECTIONYOUGIVETHEDEVELOPERTHEPOWERTOSETTHEHIGHLIGHTCOLORWHILEAPPLYINGTHEDIRECTIVE", - "original": "Currently the highlight color is hard-coded _within_ the directive. That's inflexible.\nIn this section, you give the developer the power to set the highlight color while applying the directive.", - "translation": "高亮的颜色目前是硬编码在指令中的,这不够灵活。\n在这一节中,你应该让指令的使用者可以指定要用哪种颜色进行高亮。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "BEGINBYADDINGINPUTTOTHELISTOFSYMBOLSIMPORTEDFROMANGULARCORE", - "original": "Begin by adding `Input` to the list of symbols imported from `@angular/core`.", - "translation": "先从 `@angular/core` 中导入 `Input`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ADDAHIGHLIGHTCOLORPROPERTYTOTHEDIRECTIVECLASSLIKETHIS:", - "original": "Add a `highlightColor` property to the directive class like this:", - "translation": "然后把 `highlightColor` 属性添加到指令类中,就像这样:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "###BINDINGTOANINPUTPROPERTY", - "original": "### Binding to an _@Input_ property", - "translation": "### 绑定到 *@Input* 属性", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "NOTICETHEINPUTDECORATORITADDSMETADATATOTHECLASSTHATMAKESTHEDIRECTIVESHIGHLIGHTCOLORPROPERTYAVAILABLEFORBINDING", - "original": "Notice the `@Input` decorator. It adds metadata to the class that makes the directive's `highlightColor` property available for binding.", - "translation": "注意看 `@Input` 装饰器。它往类上添加了一些元数据,从而让该指令的 `highlightColor` 能用于绑定。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ITSCALLEDANINPUTPROPERTYBECAUSEDATAFLOWSFROMTHEBINDINGEXPRESSIONINTOTHEDIRECTIVEWITHOUTTHATINPUTMETADATAANGULARREJECTSTHEBINDINGSEEBELOWGUIDEATTRIBUTEDIRECTIVES#WHYINPUTWHYADDINPUTFORMOREABOUTTHAT", - "original": "It's called an *input* property because data flows from the binding expression _into_ the directive.\nWithout that input metadata, Angular rejects the binding; see [below](guide/attribute-directives#why-input \"Why add @Input?\") for more about that.", - "translation": "它之所以称为*输入*属性,是因为数据流是从绑定表达式流向指令内部的。\n如果没有这个元数据,Angular 就会拒绝绑定,参见[稍后](guide/attribute-directives#why-input \"为什么要添加@Input?\")了解更多。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "TRYITBYADDINGTHEFOLLOWINGDIRECTIVEBINDINGVARIATIONSTOTHEAPPCOMPONENTTEMPLATE:", - "original": "Try it by adding the following directive binding variations to the `AppComponent` template:", - "translation": "试试把下列指令绑定变量添加到 `AppComponent` 的模板中:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ADDACOLORPROPERTYTOTHEAPPCOMPONENT", - "original": "Add a `color` property to the `AppComponent`.", - "translation": "把 `color` 属性添加到 `AppComponent` 中:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "LETITCONTROLTHEHIGHLIGHTCOLORWITHAPROPERTYBINDING", - "original": "Let it control the highlight color with a property binding.", - "translation": "让它通过属性绑定来控制高亮颜色。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THATSGOODBUTITWOULDBENICETOSIMULTANEOUSLYAPPLYTHEDIRECTIVEANDSETTHECOLORINTHESAMEATTRIBUTELIKETHIS", - "original": "That's good, but it would be nice to _simultaneously_ apply the directive and set the color _in the same attribute_ like this.", - "translation": "很不错,但如果可以在应用该指令时在*同一个属性*中设置颜色就更好了,就像这样:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEAPPHIGHLIGHTATTRIBUTEBINDINGBOTHAPPLIESTHEHIGHLIGHTINGDIRECTIVETOTHEPELEMENTANDSETSTHEDIRECTIVESHIGHLIGHTCOLORWITHAPROPERTYBINDINGYOUREREUSINGTHEDIRECTIVESATTRIBUTESELECTORAPPHIGHLIGHTTODOBOTHJOBSTHATSACRISPCOMPACTSYNTAX", - "original": "The `[appHighlight]` attribute binding both applies the highlighting directive to the `

    ` element\nand sets the directive's highlight color with a property binding.\nYou're re-using the directive's attribute selector (`[appHighlight]`) to do both jobs.\nThat's a crisp, compact syntax.", - "translation": "`[appHighlight]` 属性同时做了两件事:把这个高亮指令应用到了 `

    ` 元素上,并且通过属性绑定设置了该指令的高亮颜色。\n你复用了该指令的属性选择器 `[appHighlight]` 来同时完成它们。\n这是清爽、简约的语法。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "YOULLHAVETORENAMETHEDIRECTIVESHIGHLIGHTCOLORPROPERTYTOAPPHIGHLIGHTBECAUSETHATSNOWTHECOLORPROPERTYBINDINGNAME", - "original": "You'll have to rename the directive's `highlightColor` property to `appHighlight` because that's now the color property binding name.", - "translation": "你还要把该指令的 `highlightColor` 改名为 `myHighlight`,因为它是颜色属性目前的绑定名。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THISISDISAGREEABLETHEWORDAPPHIGHLIGHTISATERRIBLEPROPERTYNAMEANDITDOESNTCONVEYTHEPROPERTYSINTENT", - "original": "This is disagreeable. The word, `appHighlight`, is a terrible property name and it doesn't convey the property's intent.", - "translation": "这可不好。因为 `appHighlight` 是一个糟糕的属性名,而且不能反映该属性的意图。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "###BINDTOANINPUTALIAS", - "original": "### Bind to an _@Input_ alias", - "translation": "### 绑定到 *@Input* 别名", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "FORTUNATELYYOUCANNAMETHEDIRECTIVEPROPERTYWHATEVERYOUWANTANDALIASITFORBINDINGPURPOSES", - "original": "Fortunately you can name the directive property whatever you want _and_ **_alias it_** for binding purposes.", - "translation": "幸运的是,你可以随意命名该指令的属性,并且**给它指定一个用于绑定的别名**。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "RESTORETHEORIGINALPROPERTYNAMEANDSPECIFYTHESELECTORASTHEALIASINTHEARGUMENTTOINPUT", - "original": "Restore the original property name and specify the selector as the alias in the argument to `@Input`.", - "translation": "恢复原始属性名,并在 `@Input` 的参数中把选择器 `myHighlight` 指定为别名。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "INSIDETHEDIRECTIVETHEPROPERTYISKNOWNASHIGHLIGHTCOLOROUTSIDETHEDIRECTIVEWHEREYOUBINDTOITITSKNOWNASAPPHIGHLIGHT", - "original": "_Inside_ the directive the property is known as `highlightColor`.\n_Outside_ the directive, where you bind to it, it's known as `appHighlight`.", - "translation": "在指令内部,该属性叫 `highlightColor`,在外部,你绑定到它地方,它叫 `appHighlight`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "YOUGETTHEBESTOFBOTHWORLDS:THEPROPERTYNAMEYOUWANTANDTHEBINDINGSYNTAXYOUWANT:", - "original": "You get the best of both worlds: the property name you want and the binding syntax you want:", - "translation": "这是最好的结果:理想的内部属性名,理想的绑定语法:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "NOWTHATYOUREBINDINGVIATHEALIASTOTHEHIGHLIGHTCOLORMODIFYTHEONMOUSEENTERMETHODTOUSETHATPROPERTYIFSOMEONENEGLECTSTOBINDTOAPPHIGHLIGHTCOLORHIGHLIGHTTHEHOSTELEMENTINRED:", - "original": "Now that you're binding via the alias to the `highlightColor`, modify the `onMouseEnter()` method to use that property.\nIf someone neglects to bind to `appHighlightColor`, highlight the host element in red:", - "translation": "现在,你通过别名绑定到了 `highlightColor` 属性,并修改 `onMouseEnter()` 方法来使用它。\n如果有人忘了绑定到 `appHighlightColor`,那就用红色进行高亮。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "HERESTHELATESTVERSIONOFTHEDIRECTIVECLASS", - "original": "Here's the latest version of the directive class.", - "translation": "这是最终版本的指令类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "##WRITEAHARNESSTOTRYIT", - "original": "## Write a harness to try it", - "translation": "## 写个测试程序试验下", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ITMAYBEDIFFICULTTOIMAGINEHOWTHISDIRECTIVEACTUALLYWORKSINTHISSECTIONYOULLTURNAPPCOMPONENTINTOAHARNESSTHATLETSYOUPICKTHEHIGHLIGHTCOLORWITHARADIOBUTTONANDBINDYOURCOLORCHOICETOTHEDIRECTIVE", - "original": "It may be difficult to imagine how this directive actually works.\nIn this section, you'll turn `AppComponent` into a harness that\nlets you pick the highlight color with a radio button and bind your color choice to the directive.", - "translation": "凭空想象该指令如何工作可不容易。\n在本节,你将把 `AppComponent` 改成一个测试程序,它让你可以通过单选按钮来选取高亮颜色,并且把你选取的颜色绑定到指令中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "UPDATECODEAPPCOMPONENTHTMLCODEASFOLLOWS:", - "original": "Update app.component.html as follows:", - "translation": "把 `app.component.html` 修改成这样:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "REVISETHEAPPCOMPONENTCOLORSOTHATITHASNOINITIALVALUE", - "original": "Revise the `AppComponent.color` so that it has no initial value.", - "translation": "修改 `AppComponent.color`,让它不再有初始值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "HEREARETHEHARNESSANDDIRECTIVEINACTION", - "original": "Here are the harness and directive in action.", - "translation": "下面是测试程序和指令的动图。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "##BINDTOASECONDPROPERTY", - "original": "## Bind to a second property", - "translation": "## 绑定到第二个属性", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THISHIGHLIGHTDIRECTIVEHASASINGLECUSTOMIZABLEPROPERTYINAREALAPPITMAYNEEDMORE", - "original": "This highlight directive has a single customizable property. In a real app, it may need more.", - "translation": "本例的指令只有一个可定制属性,真实的应用通常需要更多。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ATTHEMOMENTTHEDEFAULTCOLORMDASHTHECOLORTHATPREVAILSUNTILTHEUSERPICKSAHIGHLIGHTCOLORMDASHISHARDCODEDASREDLETTHETEMPLATEDEVELOPERSETTHEDEFAULTCOLOR", - "original": "At the moment, the default color—the color that prevails until\nthe user picks a highlight color—is hard-coded as \"red\".\nLet the template developer set the default color.", - "translation": "目前,默认颜色(它在用户选取了高亮颜色之前一直有效)被硬编码为红色。应该允许模板的开发者设置默认颜色。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ADDASECONDINPUTPROPERTYTOHIGHLIGHTDIRECTIVECALLEDDEFAULTCOLOR:", - "original": "Add a second **input** property to `HighlightDirective` called `defaultColor`:", - "translation": "把第二个名叫 `defaultColor` 的**输入**属性添加到 `HighlightDirective` 中:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "REVISETHEDIRECTIVESONMOUSEENTERSOTHATITFIRSTTRIESTOHIGHLIGHTWITHTHEHIGHLIGHTCOLORTHENWITHTHEDEFAULTCOLORANDFALLSBACKTOREDIFBOTHPROPERTIESAREUNDEFINED", - "original": "Revise the directive's `onMouseEnter` so that it first tries to highlight with the `highlightColor`,\nthen with the `defaultColor`, and falls back to \"red\" if both properties are undefined.", - "translation": "修改该指令的 `onMouseEnter`,让它首先尝试使用 `highlightColor` 进行高亮,然后用 `defaultColor`,如果它们都没有指定,那就用红色作为后备。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "HOWDOYOUBINDTOASECONDPROPERTYWHENYOUREALREADYBINDINGTOTHEAPPHIGHLIGHTATTRIBUTENAME", - "original": "How do you bind to a second property when you're already binding to the `appHighlight` attribute name?", - "translation": "当已经绑定过 `appHighlight` 属性时,要如何绑定到第二个属性呢?", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ASWITHCOMPONENTSYOUCANADDASMANYDIRECTIVEPROPERTYBINDINGSASYOUNEEDBYSTRINGINGTHEMALONGINTHETEMPLATETHEDEVELOPERSHOULDBEABLETOWRITETHEFOLLOWINGTEMPLATEHTMLTOBOTHBINDTOTHEAPPCOMPONENTCOLORANDFALLBACKTOVIOLETASTHEDEFAULTCOLOR", - "original": "As with components, you can add as many directive property bindings as you need by stringing them along in the template.\nThe developer should be able to write the following template HTML to both bind to the `AppComponent.color`\nand fall back to \"violet\" as the default color.", - "translation": "像组件一样,你也可以绑定到指令的很多属性,只要把它们依次写在模板中就行了。\n开发者可以绑定到 `AppComponent.color`,并且用紫罗兰色作为默认颜色,代码如下:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "ANGULARKNOWSTHATTHEDEFAULTCOLORBINDINGBELONGSTOTHEHIGHLIGHTDIRECTIVEBECAUSEYOUMADEITPUBLICWITHTHEINPUTDECORATOR", - "original": "Angular knows that the `defaultColor` binding belongs to the `HighlightDirective`\nbecause you made it _public_ with the `@Input` decorator.", - "translation": "Angular 之所以知道 `defaultColor` 绑定属于 `HighlightDirective`,是因为你已经通过 `@Input` 装饰器把它设置成了*公共*属性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "HERESHOWTHEHARNESSSHOULDWORKWHENYOUREDONECODING", - "original": "Here's how the harness should work when you're done coding.", - "translation": "当这些代码完成时,测试程序工作时的动图如下:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "##SUMMARY", - "original": "## Summary", - "translation": "## 小结", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THISPAGECOVEREDHOWTO:", - "original": "This page covered how to:", - "translation": "本章介绍了如何:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "BUILDANATTRIBUTEDIRECTIVEGUIDEATTRIBUTEDIRECTIVES#WRITEDIRECTIVETHATMODIFIESTHEBEHAVIOROFANELEMENT", - "original": "* [Build an **attribute directive**](guide/attribute-directives#write-directive) that modifies the behavior of an element.", - "translation": "[构建一个**属性型指令**](guide/attribute-directives#write-directive),它用于修改一个元素的行为。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "APPLYTHEDIRECTIVEGUIDEATTRIBUTEDIRECTIVES#APPLYDIRECTIVETOANELEMENTINATEMPLATE", - "original": "* [Apply the directive](guide/attribute-directives#apply-directive) to an element in a template.", - "translation": "[把一个指令应用到](guide/attribute-directives#apply-directive)模板中的某个元素上。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "RESPONDTOEVENTSGUIDEATTRIBUTEDIRECTIVES#RESPONDTOUSERTHATCHANGETHEDIRECTIVESBEHAVIOR", - "original": "* [Respond to **events**](guide/attribute-directives#respond-to-user) that change the directive's behavior.", - "translation": "[响应**事件**](guide/attribute-directives#respond-to-user)以改变指令的行为。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "BINDVALUESTOTHEDIRECTIVEGUIDEATTRIBUTEDIRECTIVES#BINDINGS", - "original": "* [**Bind** values to the directive](guide/attribute-directives#bindings).", - "translation": "[把值**绑定**到指令中](guide/attribute-directives#bindings)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEFINALSOURCECODEFOLLOWS:", - "original": "The final source code follows:", - "translation": "最终的源码如下:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "YOUCANALSOEXPERIENCEANDDOWNLOADTHELIVEEXAMPLETITLEATTRIBUTEDIRECTIVEEXAMPLELIVEEXAMPLE", - "original": "You can also experience and download the .", - "translation": "你还可以体验和下载.", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "###APPENDIX:WHYADDINPUT", - "original": "### Appendix: Why add _@Input_?", - "translation": "### 附录:为什么要加*@Input*?", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "INTHISDEMOTHEHIGHLIGHTCOLORPROPERTYISANINPUTPROPERTYOFTHEHIGHLIGHTDIRECTIVEYOUVESEENITAPPLIEDWITHOUTANALIAS:", - "original": "In this demo, the `highlightColor` property is an ***input*** property of\nthe `HighlightDirective`. You've seen it applied without an alias:", - "translation": "在这个例子中 `hightlightColor` 是 `HighlightDirective` 的一个***输入型***属性。你见过它没有用别名时的代码:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "YOUVESEENITWITHANALIAS:", - "original": "You've seen it with an alias:", - "translation": "也见过用别名时的代码:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "EITHERWAYTHEINPUTDECORATORTELLSANGULARTHATTHISPROPERTYISPUBLICANDAVAILABLEFORBINDINGBYAPARENTCOMPONENTWITHOUTINPUTANGULARREFUSESTOBINDTOTHEPROPERTY", - "original": "Either way, the `@Input` decorator tells Angular that this property is\n_public_ and available for binding by a parent component.\nWithout `@Input`, Angular refuses to bind to the property.", - "translation": "无论哪种方式,`@Input` 装饰器都告诉 Angular,该属性是*公共的*,并且能被父组件绑定。\n如果没有 `@Input`,Angular 就会拒绝绑定到该属性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "YOUVEBOUNDTEMPLATEHTMLTOCOMPONENTPROPERTIESBEFOREANDNEVERUSEDINPUTWHATSDIFFERENT", - "original": "You've bound template HTML to component properties before and never used `@Input`.\nWhat's different?", - "translation": "但你以前也曾经把模板 HTML 绑定到组件的属性,而且从来没有用过 `@Input`。\n差异何在?", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEDIFFERENCEISAMATTEROFTRUSTANGULARTREATSACOMPONENTSTEMPLATEASBELONGINGTOTHECOMPONENTTHECOMPONENTANDITSTEMPLATETRUSTEACHOTHERIMPLICITLYTHEREFORETHECOMPONENTSOWNTEMPLATEMAYBINDTOANYPROPERTYOFTHATCOMPONENTWITHORWITHOUTTHEINPUTDECORATOR", - "original": "The difference is a matter of trust.\nAngular treats a component's template as _belonging_ to the component.\nThe component and its template trust each other implicitly.\nTherefore, the component's own template may bind to _any_ property of that component,\nwith or without the `@Input` decorator.", - "translation": "差异在于信任度不同。\nAngular 把组件的模板看做*从属于*该组件的。\n组件和它的模板默认会相互信任。\n这也就是意味着,组件自己的模板可以绑定到组件的*任意*属性,无论是否使用了 `@Input` 装饰器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "BUTACOMPONENTORDIRECTIVESHOULDNTBLINDLYTRUSTOTHERCOMPONENTSANDDIRECTIVESTHEPROPERTIESOFACOMPONENTORDIRECTIVEAREHIDDENFROMBINDINGBYDEFAULTTHEYAREPRIVATEFROMANANGULARBINDINGPERSPECTIVEWHENADORNEDWITHTHEINPUTDECORATORTHEPROPERTYBECOMESPUBLICFROMANANGULARBINDINGPERSPECTIVEONLYTHENCANITBEBOUNDBYSOMEOTHERCOMPONENTORDIRECTIVE", - "original": "But a component or directive shouldn't blindly trust _other_ components and directives.\nThe properties of a component or directive are hidden from binding by default.\nThey are _private_ from an Angular binding perspective.\nWhen adorned with the `@Input` decorator, the property becomes _public_ from an Angular binding perspective.\nOnly then can it be bound by some other component or directive.", - "translation": "但组件或指令不应该盲目的信任其它组件或指令。\n因此组件或指令的属性默认是不能被绑定的。\n从 Angular 绑定机制的角度来看,它们是*私有*的,而当添加了 `@Input` 时,它们变成了*公共*的\n只有这样,它们才能被其它组件或属性绑定。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "YOUCANTELLIFINPUTISNEEDEDBYTHEPOSITIONOFTHEPROPERTYNAMEINABINDING", - "original": "You can tell if `@Input` is needed by the position of the property name in a binding.", - "translation": "你可以根据属性名在绑定中出现的位置来判定是否要加 `@Input`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "WHENITAPPEARSINTHETEMPLATEEXPRESSIONTOTHERIGHTOFTHEEQUALSITBELONGSTOTHETEMPLATESCOMPONENTANDDOESNOTREQUIRETHEINPUTDECORATOR", - "original": "* When it appears in the template expression to the ***right*** of the equals (=),\n it belongs to the template's component and does not require the `@Input` decorator.", - "translation": "当它出现在等号***右侧***的模板表达式中时,它属于模板所在的组件,不需要 `@Input` 装饰器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "WHENITAPPEARSINSQUAREBRACKETSTOTHELEFTOFTHEEQUALSTHEPROPERTYBELONGSTOSOMEOTHERCOMPONENTORDIRECTIVETHATPROPERTYMUSTBEADORNEDWITHTHEINPUTDECORATOR", - "original": "* When it appears in **square brackets** ([ ]) to the **left** of the equals (=),\n the property belongs to some _other_ component or directive;\n that property must be adorned with the `@Input` decorator.", - "translation": "当它出现在等号**左边**的**方括号([ ])**中时,该属性属于*其它*组件或指令,它必须带有 `@Input` 装饰器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "NOWAPPLYTHATREASONINGTOTHEFOLLOWINGEXAMPLE:", - "original": "Now apply that reasoning to the following example:", - "translation": "试用此原理分析下列范例:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THECOLORPROPERTYINTHEEXPRESSIONONTHERIGHTBELONGSTOTHETEMPLATESCOMPONENTTHETEMPLATEANDITSCOMPONENTTRUSTEACHOTHERTHECOLORPROPERTYDOESNTREQUIRETHEINPUTDECORATOR", - "original": "* The `color` property in the expression on the right belongs to the template's component.\n The template and its component trust each other.\n The `color` property doesn't require the `@Input` decorator.", - "translation": "`color` 属性位于右侧的绑定表达式中,它属于模板所在的组件。\n 该模板和组件相互信任。因此 `color` 不需要 `@Input` 装饰器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "THEAPPHIGHLIGHTPROPERTYONTHELEFTREFERSTOANALIASEDPROPERTYOFTHEHIGHLIGHTDIRECTIVENOTAPROPERTYOFTHETEMPLATESCOMPONENTTHEREARETRUSTISSUESTHEREFORETHEDIRECTIVEPROPERTYMUSTCARRYTHEINPUTDECORATOR", - "original": "* The `appHighlight` property on the left refers to an _aliased_ property of the `HighlightDirective`,\n not a property of the template's component. There are trust issues.\n Therefore, the directive property must carry the `@Input` decorator.", - "translation": "`appHighlight` 属性位于左侧,它引用了 `HighlightDirective` 中一个*带别名的*属性,它不是模板所属组件的一部分,因此存在信任问题。\n所以,该属性必须带 `@Input` 装饰器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/attribute-directives.md" - }, - { - "key": "#BOOTSTRAPPING", - "original": "# Bootstrapping", - "translation": "# 启动过程", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "####PREREQUISITES", - "original": "#### Prerequisites", - "translation": "#### 前提条件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "ABASICUNDERSTANDINGOFTHEFOLLOWING:", - "original": "A basic understanding of the following:", - "translation": "对下列知识有基本的了解:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "JAVASCRIPTMODULESVSNGMODULESGUIDENGMODULEVSJSMODULE", - "original": "* [JavaScript Modules vs. NgModules](guide/ngmodule-vs-jsmodule).", - "translation": "[JavaScript 模块与 NgModules](guide/ngmodule-vs-jsmodule)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "ANNGMODULEDESCRIBESHOWTHEAPPLICATIONPARTSFITTOGETHEREVERYAPPLICATIONHASATLEASTONEANGULARMODULETHEROOTMODULETHATYOUBOOTSTRAPTOLAUNCHTHEAPPLICATIONBYCONVENTIONITISUSUALLYCALLEDAPPMODULE", - "original": "An NgModule describes how the application parts fit together.\nEvery application has at least one Angular module, the _root_ module\nthat you bootstrap to launch the application.\nBy convention, it is usually called `AppModule`.", - "translation": "NgModule 用于描述应用的各个部分如何组织在一起。\n每个应用又至少一个 Angular 模块,*根*模块就是你用来启动此应用的模块。\n按照惯例,它通常命名为 `AppModule`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "IFYOUUSETHECLITOGENERATEANAPPTHEDEFAULTAPPMODULEISASFOLLOWS:", - "original": "If you use the CLI to generate an app, the default `AppModule` is as follows:", - "translation": "如果你使用 CLI 来生成一个应用,其默认的 `AppModule` 是这样的:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "AFTERTHEIMPORTSTATEMENTSISACLASSWITHTHENGMODULEDECORATORGUIDEGLOSSARY#DECORATORDECORATOREXPLAINED", - "original": "After the import statements is a class with the\n**`@NgModule`** [decorator](guide/glossary#decorator '\"Decorator\" explained').", - "translation": "在 `import` 语句之后,是一个带有 **`@NgModule`** [装饰器](guide/glossary#decorator '\"Decorator\" explained')的类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THENGMODULEDECORATORIDENTIFIESAPPMODULEASANNGMODULECLASSNGMODULETAKESAMETADATAOBJECTTHATTELLSANGULARHOWTOCOMPILEANDLAUNCHTHEAPPLICATION", - "original": "The `@NgModule` decorator identifies `AppModule` as an `NgModule` class.\n`@NgModule` takes a metadata object that tells Angular how to compile and launch the application.", - "translation": "`@NgModule` 装饰器表明 `AppModule` 是一个 `NgModule` 类。\n`@NgModule` 获取一个元数据对象,它会告诉 Angular 如何编译和启动本应用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "DECLARATIONSMDASHTHISAPPLICATIONSLONECOMPONENT", - "original": "* **_declarations_**—this application's lone component.", - "translation": "**_declarations_** —— 该应用所拥有的组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "IMPORTSMDASHIMPORTBROWSERMODULETOHAVEBROWSERSPECIFICSERVICESSUCHASDOMRENDERINGSANITIZATIONANDLOCATION", - "original": "* **_imports_**—import `BrowserModule` to have browser specific services such as DOM rendering, sanitization, and location.", - "translation": "**_imports_** —— 导入 `BrowserModule` 以获取浏览器特有的服务,比如 DOM 渲染、无害化处理和位置(location)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "PROVIDERSMDASHTHESERVICEPROVIDERS", - "original": "* **_providers_**—the service providers.", - "translation": "**_providers_** —— 各种服务提供商。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "BOOTSTRAPMDASHTHEROOTCOMPONENTTHATANGULARCREATESANDINSERTSINTOTHEINDEXHTMLHOSTWEBPAGE", - "original": "* **_bootstrap_**—the _root_ component that Angular creates and inserts\ninto the `index.html` host web page.", - "translation": "**_bootstrap_** —— *根*组件,Angular 创建它并插入 `index.html` 宿主页面。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THEDEFAULTCLIAPPLICATIONONLYHASONECOMPONENTAPPCOMPONENTSOITISINBOTHTHEDECLARATIONSANDTHEBOOTSTRAPARRAYS", - "original": "The default CLI application only has one component, `AppComponent`, so it\nis in both the `declarations` and the `bootstrap` arrays.", - "translation": "默认的 CLI 应用只有一个组件 `AppComponent`,所以它会同时出现在 `declarations` 和 `bootstrap` 数组中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "##THEDECLARATIONSARRAY", - "original": "## The `declarations` array", - "translation": "## `declarations` 数组", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THEMODULESDECLARATIONSARRAYTELLSANGULARWHICHCOMPONENTSBELONGTOTHATMODULEASYOUCREATEMORECOMPONENTSADDTHEMTODECLARATIONS", - "original": "The module's `declarations` array tells Angular which components belong to that module.\nAs you create more components, add them to `declarations`.", - "translation": "该模块的 `declarations` 数组告诉 Angular 哪些组件属于该模块。\n当你创建更多组件时,也要把它们添加到 `declarations` 中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "YOUMUSTDECLAREEVERYCOMPONENTINEXACTLYONENGMODULECLASSIFYOUUSEACOMPONENTWITHOUTDECLARINGITANGULARRETURNSANERRORMESSAGE", - "original": "You must declare every component in exactly one `NgModule` class.\nIf you use a component without declaring it, Angular returns an\nerror message.", - "translation": "每个组件都应该(且只能)声明(declare)在一个 `NgModule` 类中。 如果你使用了未声明过的组件,Angular 就会报错。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THEDECLARATIONSARRAYONLYTAKESDECLARABLESDECLARABLESARECOMPONENTSDIRECTIVESGUIDEATTRIBUTEDIRECTIVESANDPIPESGUIDEPIPESALLOFAMODULESDECLARABLESMUSTBEINTHEDECLARATIONSARRAYDECLARABLESMUSTBELONGTOEXACTLYONEMODULETHECOMPILEREMITSANERRORIFYOUTRYTODECLARETHESAMECLASSINMORETHANONEMODULE", - "original": "The `declarations` array only takes declarables. Declarables\nare components, [directives](guide/attribute-directives) and [pipes](guide/pipes).\nAll of a module's declarables must be in the `declarations` array.\nDeclarables must belong to exactly one module. The compiler emits\nan error if you try to declare the same class in more than one module.", - "translation": "`declarations` 数组只能接受可声明对象。可声明对象包括组件、[指令](guide/attribute-directives)和[管道](guide/pipes)。\n一个模块的所有可声明对象都必须放在 `declarations` 数组中。\n可声明对象必须只能属于一个模块,如果同一个类被声明在了多个模块中,编译器就会报错。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THESEDECLAREDCLASSESAREVISIBLEWITHINTHEMODULEBUTINVISIBLETOCOMPONENTSINADIFFERENTMODULEUNLESSTHEYAREEXPORTEDFROMTHISMODULEANDTHEOTHERMODULEIMPORTSTHISONE", - "original": "These declared classes are visible within the module but invisible\nto components in a different module unless they are exported from\nthis module and the other module imports this one.", - "translation": "这些可声明的类在当前模块中是可见的,但是对其它模块中的组件是不可见的 —— 除非把它们从当前模块导出,\n并让对方模块导入本模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "ANEXAMPLEOFWHATGOESINTOADECLARATIONSARRAYFOLLOWS:", - "original": "An example of what goes into a declarations array follows:", - "translation": "下面是哪些类可以添加到 `declarations` 数组中的例子:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "ADECLARABLECANONLYBELONGTOONEMODULESOONLYDECLAREITINONENGMODULEWHENYOUNEEDITELSEWHEREIMPORTTHEMODULETHATHASTHEDECLARABLEYOUNEEDINIT", - "original": "A declarable can only belong to one module, so only declare it in\none `@NgModule`. When you need it elsewhere,\nimport the module that has the declarable you need in it.", - "translation": "每个可声明对象都只能属于一个模块,所以只能把它声明在一个 `@NgModule` 中。当你需要在其它模块中使用它时,就要在那里导入包含这个可声明对象的模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "ONLYNGMODULEREFERENCESGOINTHEIMPORTSARRAY", - "original": "**Only `@NgModule` references** go in the `imports` array.", - "translation": "**只有 `@NgModule`** 可以出现在 `imports` 数组中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "###USINGDIRECTIVESWITHNGMODULE", - "original": "### Using directives with `@NgModule`", - "translation": "### 通过 `@NgModule` 使用指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "USETHEDECLARATIONSARRAYFORDIRECTIVESTOUSEADIRECTIVECOMPONENTORPIPEINAMODULEYOUMUSTDOAFEWTHINGS:", - "original": "Use the `declarations` array for directives.\nTo use a directive, component, or pipe in a module, you must do a few things:", - "translation": "使用 `declarations` 数组声明指令。在模块中使用指令、组件或管道的步骤如下:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "1EXPORTITFROMTHEFILEWHEREYOUWROTEIT", - "original": "1. Export it from the file where you wrote it.", - "translation": "从你编写它的文件中导出它。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "2IMPORTITINTOTHEAPPROPRIATEMODULE", - "original": "2. Import it into the appropriate module.", - "translation": "把它导入到适当的模块中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "3DECLAREITINTHENGMODULEDECLARATIONSARRAY", - "original": "3. Declare it in the `@NgModule` `declarations` array.", - "translation": "在 `@NgModule` 的 `declarations` 数组中声明它。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THOSETHREESTEPSLOOKLIKETHEFOLLOWINGINTHEFILEWHEREYOUCREATEYOURDIRECTIVEEXPORTITTHEFOLLOWINGEXAMPLENAMEDITEMDIRECTIVEISTHEDEFAULTDIRECTIVESTRUCTURETHATTHECLIGENERATESINITSOWNFILEITEMDIRECTIVETS:", - "original": "Those three steps look like the following. In the file where you create your directive, export it.\nThe following example, named `ItemDirective` is the default directive structure that the CLI generates in its own file, `item.directive.ts`:", - "translation": "这三步的结果如下所示。在你创建指令的文件中导出它。\n下面的例子中,`item.directive.ts` 中的 `ItemDirective` 是 CLI 自动生成的默认指令结构。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THEKEYPOINTHEREISTHATYOUHAVETOEXPORTITSOYOUCANIMPORTITELSEWHERENEXTIMPORTITINTOTHENGMODULEINTHISEXAMPLEAPPMODULETSWITHAJAVASCRIPTIMPORTSTATEMENT:", - "original": "The key point here is that you have to export it so you can import it elsewhere. Next, import it\ninto the NgModule, in this example `app.module.ts`, with a JavaScript import statement:", - "translation": "重点在于你要先在这里导出它才能在别处导入它。接下来,使用 JavaScript 的 `import` 语句把它导入到 NgModule 中(这里是 `app.module.ts`)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "ANDINTHESAMEFILEADDITTOTHENGMODULEDECLARATIONSARRAY:", - "original": "And in the same file, add it to the `@NgModule` `declarations` array:", - "translation": "同样在这个文件中,把它添加到 `@NgModule` 的 `declarations` 数组中:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "NOWYOUCOULDUSEYOURITEMDIRECTIVEINACOMPONENTTHISEXAMPLEUSESAPPMODULEBUTYOUDDOITTHESAMEWAYFORAFEATUREMODULEFORMOREABOUTDIRECTIVESSEEATTRIBUTEDIRECTIVESGUIDEATTRIBUTEDIRECTIVESANDSTRUCTURALDIRECTIVESGUIDESTRUCTURALDIRECTIVESYOUDALSOUSETHESAMETECHNIQUEFORPIPESGUIDEPIPESANDCOMPONENTS", - "original": "Now you could use your `ItemDirective` in a component. This example uses `AppModule`, but you'd do it the same way for a feature module. For more about directives, see [Attribute Directives](guide/attribute-directives) and [Structural Directives](guide/structural-directives). You'd also use the same technique for [pipes](guide/pipes) and components.", - "translation": "现在,你就可以在组件中使用 `ItemDirective` 了。这个例子中使用的是 `AppModule`,但是在特性模块中你也可以这么做。\n要进一步了解指令,参见[属性型指令](guide/attribute-directives)和[结构型指令](guide/structural-directives)。\n这些也同样适用于[管道](guide/pipes)和组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "REMEMBERCOMPONENTSDIRECTIVESANDPIPESBELONGTOONEMODULEONLYYOUONLYNEEDTODECLARETHEMONCEINYOURAPPBECAUSEYOUSHARETHEMBYIMPORTINGTHENECESSARYMODULESTHISSAVESYOUTIMEANDHELPSKEEPYOURAPPLEAN", - "original": "Remember, components, directives, and pipes belong to one module only. You only need to declare them once in your app because you share them by importing the necessary modules. This saves you time and helps keep your app lean.", - "translation": "记住:组件、指令和管道都只能属于一个模块。你在应用中也只需要声明它们一次,因为你还可以通过导入必要的模块来使用它们。这能节省你的时间,并且帮助你的应用保持精简。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "##THEIMPORTSARRAY", - "original": "## The `imports` array", - "translation": "## `imports` 数组", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THEMODULESIMPORTSARRAYAPPEARSEXCLUSIVELYINTHENGMODULEMETADATAOBJECTITTELLSANGULARABOUTOTHERNGMODULESTHATTHISPARTICULARMODULENEEDSTOFUNCTIONPROPERLY", - "original": "The module's `imports` array appears exclusively in the `@NgModule` metadata object.\nIt tells Angular about other NgModules that this particular module needs to function properly.", - "translation": "模块的 `imports` 数组只会出现在 `@NgModule` 元数据对象中。\n它告诉 Angular 该模块想要正常工作,还需要哪些模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THISLISTOFMODULESARETHOSETHATEXPORTCOMPONENTSDIRECTIVESORPIPESTHATTHECOMPONENTTEMPLATESINTHISMODULEREFERENCEINTHISCASETHECOMPONENTISAPPCOMPONENTWHICHREFERENCESCOMPONENTSDIRECTIVESORPIPESINBROWSERMODULEFORMSMODULEORHTTPMODULEACOMPONENTTEMPLATECANREFERENCEANOTHERCOMPONENTDIRECTIVEORPIPEWHENTHEREFERENCEDCLASSISDECLAREDINTHISMODULEORTHECLASSWASIMPORTEDFROMANOTHERMODULE", - "original": "This list of modules are those that export components, directives, or pipes\nthat the component templates in this module reference. In this case, the component is\n`AppComponent`, which references components, directives, or pipes in `BrowserModule`,\n`FormsModule`, or `HttpModule`.\nA component template can reference another component, directive,\nor pipe when the referenced class is declared in this module or\nthe class was imported from another module.", - "translation": "列表中的模块导出了本模块中的各个组件模板中所引用的各个组件、指令或管道。在这个例子中,当前组件是 `AppComponent`,它引用了导出自 `BrowserModule`、`FormsModule` 或 `HttpModule` 的组件、指令或管道。\n总之,组件的模板中可以引用在当前模块中声明的或从其它模块中导入的组件、指令、管道。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "YOUDONTHAVEANYSERVICESTOPROVIDEYETBUTYOUWILLCREATESOMEBEFORELONGANDYOUMAYCHOSETOPROVIDEMANYOFTHEMHERE", - "original": "You don't have any services to provide yet.\nBut you will create some before long and you may chose to provide many of them here.", - "translation": "你还没有提供任何服务,但是很快就会创建一些,而且可能也会选择在这里提供它们。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "##THEPROVIDERSARRAY", - "original": "## The `providers` array", - "translation": "## `providers` 数组", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THEPROVIDERSARRAYISWHEREYOULISTTHESERVICESTHEAPPNEEDSWHENYOULISTSERVICESHERETHEYAREAVAILABLEAPPWIDEYOUCANSCOPETHEMWHENUSINGFEATUREMODULESANDLAZYLOADINGFORMOREINFORMATIONSEEPROVIDERSGUIDEPROVIDERS", - "original": "The providers array is where you list the services the app needs. When\nyou list services here, they are available app-wide. You can scope\nthem when using feature modules and lazy loading. For more information, see\n[Providers](guide/providers).", - "translation": "`providers` 数组中列出了该应用所需的服务。当直接把服务列在这里时,它们是全应用范围的。\n当你使用特性模块和惰性加载时,它们是范围化的。要了解更多,参见[服务提供商](guide/providers)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "##THEBOOTSTRAPARRAY", - "original": "## The `bootstrap` array", - "translation": "## `bootstrap` 数组", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THEAPPLICATIONLAUNCHESBYBOOTSTRAPPINGTHEROOTAPPMODULEWHICHISALSOREFERREDTOASANENTRYCOMPONENTAMONGOTHERTHINGSTHEBOOTSTRAPPINGPROCESSCREATESTHECOMPONENTSLISTEDINTHEBOOTSTRAPARRAYANDINSERTSEACHONEINTOTHEBROWSERDOM", - "original": "The application launches by bootstrapping the root `AppModule`, which is\nalso referred to as an `entryComponent`.\nAmong other things, the bootstrapping process creates the component(s) listed in the `bootstrap` array\nand inserts each one into the browser DOM.", - "translation": "应用是通过引导根模块 `AppModule` 来启动的,根模块还引用了 `entryComponent`。\n此外,引导过程还会创建 `bootstrap` 数组中列出的组件,并把它们逐个插入到浏览器的 DOM 中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "EACHBOOTSTRAPPEDCOMPONENTISTHEBASEOFITSOWNTREEOFCOMPONENTSINSERTINGABOOTSTRAPPEDCOMPONENTUSUALLYTRIGGERSACASCADEOFCOMPONENTCREATIONSTHATFILLOUTTHATTREE", - "original": "Each bootstrapped component is the base of its own tree of components.\nInserting a bootstrapped component usually triggers a cascade of\ncomponent creations that fill out that tree.", - "translation": "每个被引导的组件都是它自己的组件树的根。\n插入一个被引导的组件通常触发一系列组件的创建并形成组件树。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "WHILEYOUCANPUTMORETHANONECOMPONENTTREEONAHOSTWEBPAGEMOSTAPPLICATIONSHAVEONLYONECOMPONENTTREEANDBOOTSTRAPASINGLEROOTCOMPONENT", - "original": "While you can put more than one component tree on a host web page,\nmost applications have only one component tree and bootstrap a single root component.", - "translation": "虽然也可以在宿主页面中放多个组件,但是大多数应用只有一个组件树,并且只从一个根组件开始引导。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "THISONEROOTCOMPONENTISUSUALLYCALLEDAPPCOMPONENTANDISINTHEROOTMODULESBOOTSTRAPARRAY", - "original": "This one root component is usually called `AppComponent` and is in the\nroot module's `bootstrap` array.", - "translation": "这个根组件通常叫做 `AppComponent`,并且位于根模块的 `bootstrap` 数组中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "##MOREABOUTANGULARMODULES", - "original": "## More about Angular Modules", - "translation": "## 关于 Angular 模块的更多知识", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "FORMOREONNGMODULESYOURELIKELYTOSEEFREQUENTLYINAPPSSEEFREQUENTLYUSEDMODULESGUIDEFREQUENTNGMODULES", - "original": "For more on NgModules you're likely to see frequently in apps,\nsee [Frequently Used Modules](guide/frequent-ngmodules).", - "translation": "要进一步了解常见的 NgModules 知识,参见 [关于模块的常见问题](guide/frequent-ngmodules)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" - }, - { - "key": "#BROWSERSUPPORT", - "original": "# Browser support", - "translation": "# 浏览器支持", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "ANGULARSUPPORTSMOSTRECENTBROWSERSTHISINCLUDESTHEFOLLOWINGSPECIFICVERSIONS:", - "original": "Angular supports most recent browsers. This includes the following specific versions:", - "translation": "Angular 支持大多数常用浏览器,包括下列版本:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "BROWSER", - "original": "Browser", - "translation": "浏览器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "SUPPORTEDVERSIONS", - "original": "Supported versions", - "translation": "支持的版本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "LATEST", - "original": "latest", - "translation": "最新版", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "LATEST", - "original": "latest", - "translation": "最新版", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "2MOSTRECENTMAJORVERSIONS", - "original": "2 most recent major versions", - "translation": "最近的两个主版本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "2MOSTRECENTMAJORVERSIONS", - "original": "2 most recent major versions", - "translation": "最近的两个主版本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "2MOSTRECENTMAJORVERSIONS", - "original": "2 most recent major versions", - "translation": "最近的两个主版本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "ANGULARSCONTINUOUSINTEGRATIONPROCESSRUNSUNITTESTSOFTHEFRAMEWORKONALLOFTHESEBROWSERSFOREVERYPULLREQUESTUSINGAHREFHTTPS:SAUCELABSCOMSAUCELABSAANDAHREFHTTPS:WWWBROWSERSTACKCOMBROWSERSTACKA", - "original": "Angular's continuous integration process runs unit tests of the framework on all of these browsers for every pull request,\nusing SauceLabs and\nBrowserstack.", - "translation": "Angular 在持续集成过程中,对每一个提交都会使用 SauceLabs 和\nBrowserstack 在上述所有浏览器上执行单元测试。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "##POLYFILLS", - "original": "## Polyfills", - "translation": "## 腻子脚本 (polyfill)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "ANGULARISBUILTONTHELATESTSTANDARDSOFTHEWEBPLATFORMTARGETINGSUCHAWIDERANGEOFBROWSERSISCHALLENGINGBECAUSETHEYDONOTSUPPORTALLFEATURESOFMODERNBROWSERS", - "original": "Angular is built on the latest standards of the web platform.\nTargeting such a wide range of browsers is challenging because they do not support all features of modern browsers.", - "translation": "Angular 构建于 Web 平台的最新标准之上。\n要支持这么多浏览器是一个不小的挑战,因为它们不支持现代浏览器的所有特性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "YOUCOMPENSATEBYLOADINGPOLYFILLSCRIPTSPOLYFILLSFORTHEBROWSERSTHATYOUMUSTSUPPORTTHETABLEBELOW#POLYFILLLIBSIDENTIFIESMOSTOFTHEPOLYFILLSYOUMIGHTNEED", - "original": "You compensate by loading polyfill scripts (\"polyfills\") for the browsers that you must support.\nThe [table below](#polyfill-libs) identifies most of the polyfills you might need.", - "translation": "你可以通过加载腻子脚本(\"polyfills\")来为想要支持的浏览器弥补这些特性。\n[下表](#polyfill-libs) 列出了可能用到的大多数腻子脚本。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "THESUGGESTEDPOLYFILLSARETHEONESTHATRUNFULLANGULARAPPLICATIONSYOUMAYNEEDADDITIONALPOLYFILLSTOSUPPORTFEATURESNOTCOVEREDBYTHISLISTNOTETHATPOLYFILLSCANNOTMAGICALLYTRANSFORMANOLDSLOWBROWSERINTOAMODERNFASTONE", - "original": "The suggested polyfills are the ones that run full Angular applications.\nYou may need additional polyfills to support features not covered by this list.\nNote that polyfills cannot magically transform an old, slow browser into a modern, fast one.", - "translation": "这些建议的腻子脚本是运行完整 Angular 应用所需的。\n你可能还会需要另一些的腻子脚本来支持没有出现在此列表中的哪些特性。\n注意,这些腻子脚本并没有神奇的魔力来把老旧、慢速的浏览器变成现代、快速的浏览器,它只是填充了 API。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "##ENABLINGPOLYFILLS", - "original": "## Enabling polyfills", - "translation": "## 启用腻子脚本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "ANGULARCLIHTTPS:GITHUBCOMANGULARANGULARCLIWIKIUSERSENABLEPOLYFILLSTHROUGHTHESRCPOLYFILLSTSFILETHATTHECLICREATEDWITHYOURPROJECT", - "original": "[Angular CLI](https://github.com/angular/angular-cli/wiki) users enable polyfills through the `src/polyfills.ts` file that\nthe CLI created with your project.", - "translation": "[Angular CLI](https://github.com/angular/angular-cli/wiki) 的用户可以通过自动创建的 `src/polyfills.ts` 文件来启用这些腻子脚本。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "THISFILEINCORPORATESTHEMANDATORYANDMANYOFTHEOPTIONALPOLYFILLSASJAVASCRIPTIMPORTSTATEMENTS", - "original": "This file incorporates the mandatory and many of the optional polyfills as JavaScript `import` statements.", - "translation": "这个文件把强制的和很多可选的腻子脚本组织成 JavaScript 的 `import` 语句。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "THENPMPACKAGESFORTHEMANDATORYPOLYFILLSSUCHASZONEJSWEREINSTALLEDAUTOMATICALLYFORYOUWHENYOUCREATEDYOURPROJECTANDTHEIRCORRESPONDINGIMPORTSTATEMENTSAREREADYTOGOYOUPROBABLYWONTTOUCHTHESE", - "original": "The npm packages for the _mandatory_ polyfills (such as `zone.js`) were installed automatically for you when you created your project and their corresponding `import` statements are ready to go. You probably won't touch these.", - "translation": "**强制性** 腻子脚本(如 `zone.js`)的 npm 包在创建项目时就已经自动安装了,相应的 `import` 语句也都加好了。你一般不用动它们。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "BUTIFYOUNEEDANOPTIONALPOLYFILLYOULLHAVETOINSTALLITSNPMPACKAGEFOREXAMPLEIFYOUNEEDTHEWEBANIMATIONSPOLYFILLHTTP:CANIUSECOM#FEATWEBANIMATIONYOUCOULDINSTALLITWITHNPMUSINGTHEFOLLOWINGCOMMANDORTHEYARNEQUIVALENT:", - "original": "But if you need an optional polyfill, you'll have to install its npm package.\nFor example, [if you need the web animations polyfill](http://caniuse.com/#feat=web-animation), you could install it with `npm`, using the following command (or the `yarn` equivalent):", - "translation": "但是如果要用一个可选的腻子脚本,就要通过 `npm` 或 `yarn` 来安装它们的 npm 包了。\n比如,[如果你需要 web 动画的腻子脚本](http://caniuse.com/#feat=web-animation),就要通过下列命令之一来安装它:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "THENOPENTHEPOLYFILLSTSFILEANDUNCOMMENTTHECORRESPONDINGIMPORTSTATEMENTASINTHEFOLLOWINGEXAMPLE:", - "original": "Then open the `polyfills.ts` file and un-comment the corresponding `import` statement as in the following example:", - "translation": "然后打开 `polyfills.ts` 文件,并反注释对应的 `import` 语句,就像这样:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "IFYOUCANTFINDTHEPOLYFILLYOUWANTINPOLYFILLSTSADDITYOURSELFFOLLOWINGTHESAMEPATTERN:", - "original": "If you can't find the polyfill you want in `polyfills.ts`,\nadd it yourself, following the same pattern:", - "translation": "如果在 `polyfills.ts` 中找不到要使用的腻子脚本,就可以仿照下列模式自行添加它:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "1INSTALLTHENPMPACKAGE", - "original": "1. install the npm package", - "translation": "安装 npm 包", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "1IMPORTTHEFILEINPOLYFILLSTS", - "original": "1. `import` the file in `polyfills.ts`", - "translation": "在 `polyfills.ts` 中 `import` 这个文件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "NONCLIUSERSSHOULDFOLLOWTHEINSTRUCTIONSBELOW#NONCLI", - "original": "Non-CLI users should follow the instructions [below](#non-cli).", - "translation": "不使用 CLI 的用户可以遵循[下列](#non-cli)步骤自行操作。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "###MANDATORYPOLYFILLS", - "original": "### Mandatory polyfills", - "translation": "### 强制性腻子脚本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "THESEARETHEPOLYFILLSREQUIREDTORUNANANGULARAPPLICATIONONEACHSUPPORTEDBROWSER:", - "original": "These are the polyfills required to run an Angular application on each supported browser:", - "translation": "下表中的腻子脚本是每个浏览器都要用到的:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "BROWSERSDESKTOPMOBILE", - "original": "Browsers (Desktop & Mobile)", - "translation": "浏览器(桌面和移动)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "POLYFILLSREQUIRED", - "original": "Polyfills Required", - "translation": "需要的腻子脚本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "ES7REFLECTGUIDEBROWSERSUPPORT#COREES7REFLECTJITONLY", - "original": "[ES7/reflect](guide/browser-support#core-es7-reflect) (JIT only)", - "translation": "[ES7/reflect](guide/browser-support#core-es7-reflect) (仅 JIT)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "###OPTIONALBROWSERFEATURESTOPOLYFILL", - "original": "### Optional browser features to polyfill", - "translation": "### 可选浏览器特性的腻子脚本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "SOMEFEATURESOFANGULARMAYREQUIREADDITIONALPOLYFILLS", - "original": "Some features of Angular may require additional polyfills.", - "translation": "有些 Angular 特性可能需要额外的腻子脚本。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "FOREXAMPLETHEANIMATIONSLIBRARYRELIESONTHESTANDARDWEBANIMATIONAPIWHICHISONLYAVAILABLEINCHROMEANDFIREFOXTODAYNOTETHATTHEDEPENDENCYOFWEBANIMATIONSJSINANGULARISONLYNECESSARYIFANIMATIONBUILDERISUSED", - "original": "For example, the animations library relies on the standard web animation API, which is only available in Chrome and Firefox today.\n(note that the dependency of web-animations-js in Angular is only necessary if `AnimationBuilder` is used.)", - "translation": "例如,动画库依赖于标准的 web 动画 API,目前它只在 Chrome 和 Firefox 上可用。你可能需要一个腻子脚本来在其它浏览器上使用动画功能。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "HEREARETHEFEATURESWHICHMAYREQUIREADDITIONALPOLYFILLS:", - "original": "Here are the features which may require additional polyfills:", - "translation": "下列特性可能需要更多腻子脚本:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "FEATURE", - "original": "Feature", - "translation": "特性", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "POLYFILL", - "original": "Polyfill", - "translation": "腻子脚本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "BROWSERSDESKTOPMOBILE", - "original": "Browsers (Desktop & Mobile)", - "translation": "浏览器(桌面和移动)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "JITCOMPILATIONGUIDEAOTCOMPILER", - "original": "[JIT compilation](guide/aot-compiler).", - "translation": "[JIT 编译](guide/aot-compiler)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "REQUIREDTOREFLECTFORMETADATA", - "original": "Required to reflect for metadata.", - "translation": "需要 reflect 来提供元数据。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "ALLCURRENTBROWSERSENABLEDBYDEFAULTCANREMOVEIFYOUALWAYSUSEAOTANDONLYUSEANGULARDECORATORS", - "original": "All current browsers. Enabled by default.\n Can remove if you always use AOT and only use Angular decorators.", - "translation": "默认对目前的所有浏览器都启用了。如果总是使用 AOT 模式,并且只使用 Angular 自带的装饰器,那么可以移除它。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "ANIMATIONSGUIDEANIMATIONSBRONLYIFANIMATIONBUILDERISUSEDWITHINTHEAPPLICATIONSTANDARDANIMATIONSUPPORTINANGULARDOESNTREQUIREANYPOLYFILLSASOFNG6", - "original": "[Animations](guide/animations)\n
    Only if `Animation Builder` is used within the application--standard\n animation support in Angular doesn't require any polyfills (as of NG6).", - "translation": "[动画](guide/animations)\n
    只有在应用中用到了 `Animation Builder` 时才需要;Angular 标准的动画支持是不需要任何腻子脚本的(截至 NG6)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "WEBANIMATIONSGUIDEBROWSERSUPPORT#WEBANIMATIONS", - "original": "[Web Animations](guide/browser-support#web-animations)", - "translation": "[Web 动画](guide/browser-support#web-animations)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "PIFANIMATIONBUILDERISUSEDTHENTHEPOLYFILLWILLENABLESCRUBBINGSUPPORTFORIEEDGEANDSAFARICHROMEANDFIREFOXSUPPORTTHISNATIVELYP", - "original": "

    If AnimationBuilder is used then the polyfill will enable scrubbing\n support for IE/Edge and Safari (Chrome and Firefox support this natively).

    ", - "translation": "

    如果使用了 AnimationBuilder,那么腻子脚本将为 IE/Edge 和 Safari 启用擦除(scrubbing)支持(Chrome 和 Firefox 原生支持此特性)

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "IFYOUUSETHEFOLLOWINGDEPRECATEDI18NPIPES:", - "original": "If you use the following deprecated i18n pipes:", - "translation": "如果你使用下列已废弃的 i18n 管道:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "ALLBUTCHROMEFIREFOXEDGEIE11ANDSAFARI10", - "original": "All but Chrome, Firefox, Edge, IE11 and Safari 10", - "translation": "除了 Chrome、Firefox、Edge、IE11 和 Safari 10 外的所有浏览器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "ONSVGELEMENTS", - "original": "on SVG elements", - "translation": "在 SVG 元素上应用时", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "WHENSENDINGANDRECEIVINGBINARYDATA", - "original": "when sending and receiving binary data", - "translation": "用 [Http](guide/http) 发送和接收二进制数据时", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "###SUGGESTEDPOLYFILLS##", - "original": "### Suggested polyfills ##", - "translation": "### 建议的腻子脚本 ##", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "BELOWARETHEPOLYFILLSWHICHAREUSEDTOTESTTHEFRAMEWORKITSELFTHEYAREAGOODSTARTINGPOINTFORANAPPLICATION", - "original": "Below are the polyfills which are used to test the framework itself. They are a good starting point for an application.", - "translation": "下表中是用来测试框架本身的腻子脚本,它们是应用程序的优质起点。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "POLYFILL", - "original": "Polyfill", - "translation": "腻子脚本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "LICENSE", - "original": "License", - "translation": "授权方式", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "SIZE", - "original": "Size*", - "translation": "大小*", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "PUBLICDOMAIN", - "original": "Public domain", - "translation": "公共域", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "FIGURESAREFORMINIFIEDANDGZIPPEDCODECOMPUTEDWITHTHEAHREFHTTP:CLOSURECOMPILERAPPSPOTCOMHOMECLOSURECOMPILERA", - "original": "\\* Figures are for minified and gzipped code,\ncomputed with the closure compiler.", - "translation": "\\* 这里的数据都按最小化并且 gzip 压缩后的版本算,是由closure compiler计算出的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "##POLYFILLSFORNONCLIUSERS", - "original": "## Polyfills for non-CLI users", - "translation": "## 非 CLI 的用户的腻子脚本", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "IFYOUARENOTUSINGTHECLIYOUSHOULDADDYOURPOLYFILLSCRIPTSDIRECTLYTOTHEHOSTWEBPAGEINDEXHTMLPERHAPSLIKETHIS", - "original": "If you are not using the CLI, you should add your polyfill scripts directly to the host web page (`index.html`), perhaps like this.", - "translation": "如果你不使用 CLI,就要直接把腻子脚本添加到宿主页(`index.html`)中,就像这样:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/browser-support.md" - }, - { - "key": "#CHANGELOG", - "original": "# Change Log", - "translation": "# 变更记录", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THEANGULARDOCUMENTATIONISALIVINGDOCUMENTWITHCONTINUOUSIMPROVEMENTSTHISLOGCALLSATTENTIONTORECENTSIGNIFICANTCHANGES", - "original": "The Angular documentation is a living document with continuous improvements.\nThis log calls attention to recent significant changes.", - "translation": "Angular 的文档将持续不断的更新和改进。本日志记录了近期最重要的变更。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##UPDATEDTOANGULAR40DOCUMENTATIONFORANGULAR2XCANBEFOUNDATV2ANGULARIOHTTPS:V2ANGULARIO", - "original": "## Updated to Angular 4.0. Documentation for Angular 2.x can be found at [v2.angular.io](https://v2.angular.io).", - "translation": "## 更新到 Angular 4.0 。Angular 2.x 的文档在 [v2.angular.cn](https://v2.angular.io) 。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##ALLMENTIONOFMODULEIDREMOVEDCOMPONENTRELATIVEPATHSGUIDEDELETED20170313", - "original": "## All mention of moduleId removed. \"Component relative paths\" guide deleted (2017-03-13)", - "translation": "## 移除了所有的 moduleId 引用。移除了“组件相对路径” 的指南。(2017-03-13)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "WEADDEDANEWSYSTEMJSPLUGINSYSTEMJSANGULARLOADERJSTOOURRECOMMENDEDSYSTEMJSCONFIGURATIONTHISPLUGINDYNAMICALLYCONVERTSCOMPONENTRELATIVEPATHSINTEMPLATEURLANDSTYLEURLSTOABSOLUTEPATHSFORYOU", - "original": "We added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration.\nThis plugin dynamically converts \"component-relative\" paths in templateUrl and styleUrls to \"absolute paths\" for you.", - "translation": "我们往建议的 SystemJS 配置中新增了一个 SystemJS 插件 (systemjs-angular-loader.js) 。\n这个插件可以帮你把 templateUrl 和 styleUrls 中的组件相对路径动态转换为绝对路径。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "WESTRONGLYENCOURAGEYOUTOONLYWRITECOMPONENTRELATIVEPATHSTHATISTHEONLYFORMOFURLDISCUSSEDINTHESEDOCSYOUNOLONGERNEEDTOWRITECOMPONENTMODULEID:MODULEIDNORSHOULDYOU", - "original": "We strongly encourage you to only write component-relative paths.\nThat is the only form of URL discussed in these docs. You no longer need to write @Component({ moduleId: module.id }), nor should you.", - "translation": "我们强烈建议你只写组件相对路径。\n这也是本文档中所使用的唯一形式。你不必再写 `@Component({ moduleId: module.id })`,而且也不应该再这么写。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##NEW:DOWNLOADABLEEXAMPLESFOREACHGUIDE20170228", - "original": "## NEW: Downloadable examples for each guide (2017-02-28)", - "translation": "## 新增:每篇指南都增加了可下载的范例程序 (2017-02-28)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "NOWYOUCANDOWNLOADTHESAMPLECODEFORANYGUIDEANDRUNITLOCALLYLOOKFORTHENEWDOWNLOADLINKSNEXTTOTHELIVEEXAMPLELINKS", - "original": "Now you can download the sample code for any guide and run it locally.\nLook for the new download links next to the \"live example\" links.", - "translation": "现在你可以为任何一篇指南下载范例程序,并且在本地运行它了。\n请在“在线例子”的链接后面查找新的下载链接。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##TEMPLATESYNTAXSTRUCTURALDIRECTIVES:REFRESHED20170206", - "original": "## Template Syntax/Structural Directives: refreshed (2017-02-06)", - "translation": "## 模板语法/结构型指令:更新了 (2017-02-06)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THETEMPLATESYNTAXGUIDETEMPLATESYNTAXANDSTRUCTURALDIRECTIVESGUIDESTRUCTURALDIRECTIVESGUIDESWERESIGNIFICANTLYREVISEDFORCLARITYACCURACYANDCURRENTRECOMMENDEDPRACTICESDISCUSSESNGCONTAINERREVISEDSAMPLESAREMORECLEARANDCOVERALLTOPICSDISCUSSED", - "original": "The [_Template-Syntax_](guide/template-syntax) and [_Structural Directives_](guide/structural-directives)\nguides were significantly revised for clarity, accuracy, and current recommended practices.\nDiscusses ``.\nRevised samples are more clear and cover all topics discussed.", - "translation": "对[模板语法](guide/template-syntax) 和 [结构型指令](guide/structural-directives)这两篇指南做了大幅修改,来让它们更加清晰、准确,并符合当前的最佳实践。\n讨论了 ``。\n修改了例子,来让它们更清晰,并且涵盖了所有讨论到的主题。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##NEW:SAMPLESRESTRUCTUREDWITHSRCFOLDER20170202", - "original": "## NEW: Samples re-structured with `src/` folder (2017-02-02)", - "translation": "## 新增:调整了范例程序的结构,移到了 `src/` 文件夹 (2017-02-02)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "ALLDOCUMENTATIONSAMPLESHAVEBEENREALIGNEDWITHTHEDEFAULTFOLDERSTRUCTUREOFTHEANGULARCLITHATSASTEPALONGTHEROADTOBASINGTHESAMPLEINTHEANGULARCLIBUTITSALSOGOODINITSOWNRIGHTITHELPSCLEARLYSEPARATEAPPCODEFROMSETUPANDCONFIGURATIONFILES", - "original": "All documentation samples have been realigned with the default folder structure of the Angular CLI.\nThat's a step along the road to basing the sample in the Angular CLI.\nBut it's also good in its own right.\nIt helps clearly separate app code from setup and configuration files.", - "translation": "所有的文档范例都已经向 Angular CLI 的默认文件夹结构看齐了。\n这是把范例迁移到 Angular CLI 过程中的一步。\n不过也不仅是为了迁移,它还能把应用代码从环境准备代码和配置代码中清晰地分离出来。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "ALLSAMPLESNOWHAVEASRCFOLDERATTHEPROJECTROOTTHEFORMERAPPFOLDERMOVESUNDERSRCREADABOUTMOVINGYOUREXISTINGPROJECTTOTHISSTRUCTUREINAHREFHTTPS:GITHUBCOMANGULARQUICKSTART#UPDATINGTOANEWERVERSIONOFTHEQUICKSTARTREPOTARGETMIGRATINGSAMPLESQUICKSTARTAPPTOTHESRCFOLDERTHEQUICKSTARTREPOUPDATEINSTRUCTIONSA", - "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/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "NOTABLY:", - "original": "Notably:", - "translation": "要点:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "APPMAINTSMOVEDTOSRCMAINTS", - "original": "* `app/main.ts` moved to `src/main.ts`.", - "translation": "把 `app/main.ts` 移到 `src/main.ts`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "APPMOVEDTOSRCAPP", - "original": "* `app/` moved to `src/app/`.", - "translation": "把 `app/` 移到 `src/app/`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "INDEXHTMLSTYLESCSSANDTSCONFIGJSONMOVEDINSIDESRC", - "original": "* `index.html`, `styles.css` and `tsconfig.json` moved inside `src/`.", - "translation": "把 `index.html`、`styles.css` 和 `tsconfig.json` 移到 `src/` 中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "SYSTEMJSCONFIGJSNOWIMPORTSMAINJSINSTEADOFAPP", - "original": "* `systemjs.config.js` now imports `main.js` instead of `app`.", - "translation": "`systemjs.config.js` 现在要导入 `main.js` 而不是 `app`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "ADDEDLITESERVERCONFIGURATIONBSCONFIGJSONTOSERVESRC", - "original": "* Added `lite-server` configuration (`bs-config.json`) to serve `src/`.", - "translation": "新增了一个 `lite-server` 配置(`bs-config.json`)以便在 `src/` 下启动开发服务器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##NEW:REACTIVEFORMSGUIDE20170131", - "original": "## NEW: Reactive Forms guide (2017-01-31)", - "translation": "## 新增:响应式(Reactive)表单指南 (2017-01-31)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THENEWREACTIVEFORMSGUIDEREACTIVEFORMSGUIDEEXPLAINSHOWANDWHYTOBUILDAREACTIVEFORMREACTIVEFORMSARETHECODEBASEDCOUNTERPARTTOTHEDECLARATIVETEMPLATEDRIVENFORMSAPPROACHINTRODUCEDINTHEFORMSGUIDEFORMSGUIDECHECKITOUTBEFOREYOUDECIDEHOWTOADDFORMSTOYOURAPPREMEMBERALSOTHATYOUCANUSEBOTHTECHNIQUESINTHESAMEAPPCHOOSINGTHEAPPROACHTHATBESTFITSEACHSCENARIO", - "original": "The new [**Reactive Forms**](guide/reactive-forms) guide explains how and why to build a \"reactive form\".\n\"Reactive Forms\" are the code-based counterpart to the declarative \"Template Driven\" forms approach\nintroduced in the [Forms](guide/forms) guide.\nCheck it out before you decide how to add forms to your app.\nRemember also that you can use both techniques in the same app,\nchoosing the approach that best fits each scenario.", - "translation": "新的[**响应式表单**](guide/reactive-forms)指南解释了如何以及何时构建“响应式表单”。\n“响应式表单”是基于代码的表单构建方式,与[表单](guide/forms)中介绍的声明“模板驱动”表单的方法相对。\n在你决定如何往应用中添加表单之前,建议先读读那一章。\n同时,别忘了你可以在同一个应用中同时使用这两种技术,根据场景来选择最合适的方法。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##NEW:DEPLOYMENTGUIDE20170130", - "original": "## NEW: Deployment guide (2017-01-30)", - "translation": "## 新增:部署指南 (2017-01-30)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THENEWDEPLOYMENTGUIDEDEPLOYMENTGUIDEDESCRIBESTECHNIQUESFORPUTTINGYOURAPPLICATIONONASERVERITINCLUDESIMPORTANTADVICEONOPTIMIZINGFORPRODUCTION", - "original": "The new [Deployment](guide/deployment) guide describes techniques for putting your application on a server.\nIt includes important advice on optimizing for production.", - "translation": "新的[部署指南](guide/deployment)讲的是如何把应用放到服务器上。\n其中包括了为生产环境进行优化的重要建议。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##HIERARCHICALDEPENDENCYINJECTION:REFRESHED20170113", - "original": "## Hierarchical Dependency Injection: refreshed (2017-01-13)", - "translation": "## 多级依赖注入:更新完毕 (2017-01-13)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "HIERARCHICALDEPENDENCYINJECTIONGUIDEHIERARCHICALDEPENDENCYINJECTIONGUIDEISSIGNIFICANTLYREVISEDCLOSESISSUE#3086REVISEDSAMPLESARECLEARERANDCOVERALLTOPICSDISCUSSED", - "original": "[Hierarchical Dependency Injection](guide/hierarchical-dependency-injection) guide is significantly revised.\nCloses issue #3086.\nRevised samples are clearer and cover all topics discussed.", - "translation": "[多级依赖注入](guide/hierarchical-dependency-injection)做了显著修改。关闭了 issue #3086。修改过的范例更加清晰,而且涵盖了讨论到的全部主题。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##MISCELLANEOUS20170105", - "original": "## Miscellaneous (2017-01-05)", - "translation": "## 杂项 (2017-01-05)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "SETUPGUIDESETUPGUIDE:ADDEDOPTIONALINSTRUCTIONSONHOWTOREMOVENONESSENTIALFILES", - "original": "* [Setup](guide/setup) guide:\nadded (optional) instructions on how to remove _non-essential_ files.", - "translation": "[环境搭建](guide/setup)指南:\n 添加了(可选的)步骤说明,告诉你如何移除*非核心*文件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "NOLONGERCONSOLIDATERXJSOPERATORIMPORTSINRXJSEXTENSIONSFILEEACHFILESHOULDIMPORTWHATITNEEDS", - "original": "* No longer consolidate RxJS operator imports in `rxjs-extensions` file; each file should import what it needs.", - "translation": "不再在 `rxjs-extensions` 文件中统一导入 RxJS 的操作符,每个文件应该各自导入它自己所需的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "ALLSAMPLESPREPENDTEMPLATESTYLEURLSWITHASABESTPRACTICE", - "original": "* All samples prepend template/style URLs with `./` as a best practice.", - "translation": "所有范例都在模板/样式的 URL 之前添加 `./` 前缀 …… 而且你在实际开发中也应该这么做。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "STYLEGUIDEGUIDESTYLEGUIDE:COPYEDITSANDREVISEDRULES", - "original": "* [Style Guide](guide/styleguide): copy edits and revised rules.", - "translation": "[风格指南](guide/styleguide):复制了编辑过的和修改过的规则。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##ROUTER:MOREDETAIL20161221", - "original": "## Router: more detail (2016-12-21)", - "translation": "## 路由:更详细 (2016-12-21)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "ADDEDMOREINFORMATIONTOTHEROUTERGUIDEROUTERGUIDEINCLUDINGSECTIONSNAMEDOUTLETSWILDCARDROUTESANDPRELOADSTRATEGIES", - "original": "Added more information to the [Router](guide/router) guide\nincluding sections named outlets, wildcard routes, and preload strategies.", - "translation": "往[路由指南](guide/router)中添加了更多信息,包括“命名出口(Outlet)”、通配符路由和预加载策略。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##HTTP:HOWTOSETDEFAULTREQUESTHEADERSANDOTHERREQUESTOPTIONS20161214", - "original": "## HTTP: how to set default request headers (and other request options) (2016-12-14)", - "translation": "## Http:如何设置默认的请求头(以及其它配置项) (2016-12-14)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "ADDEDSECTIONONHOWTOSETDEFAULTREQUESTHEADERSANDOTHERREQUESTOPTIONSTOHTTPGUIDE", - "original": "Added section on how to set default request headers (and other request options) to\nHTTP guide.", - "translation": "添加了一节“如何设置默认的请求头(以及其它配置项)”", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##TESTING:ADDEDCOMPONENTTESTPLUNKERS20161202", - "original": "## Testing: added component test plunkers (2016-12-02)", - "translation": "## 测试:添加了组件测试的 plunker 范例 (2016-12-02)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "ADDEDTWOPLUNKERSTHATEACHTESTONESIMPLECOMPONENTSOYOUCANWRITEACOMPONENTTESTPLUNKEROFYOUROWN:LIVEEXAMPLENAMESETUPPLNKRQUICKSTARTSPECSONELIVEEXAMPLEFORTHEQUICKSTARTSEEDSAPPCOMPONENTANDLIVEEXAMPLENAMETESTINGPLNKRBANNERSPECSANOTHERLIVEEXAMPLEFORTHETESTINGGUIDESBANNERCOMPONENTLINKEDTOTHESEPLUNKERSINTESTINGANDSETUPANATOMYGUIDES", - "original": "Added two plunkers that each test _one simple component_ so you can write a component test plunker of your own: one for the QuickStart seed's `AppComponent` and another for the Testing guide's `BannerComponent`.\nLinked to these plunkers in \"Testing\" and \"Setup anatomy\" guides.", - "translation": "添加了两个 plunker 例子,每个都测试一个简单的组件,以便你可以自己在 plunker 中写组件测试:一个用于测试快速起步中的 `AppComponent`,另一个用于测试“测试”章节的 `BannerComponent`。\n并在“测试”和“环境设置剖析”中链接到它们。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##INTERNATIONALIZATION:PLURALIZATIONANDSELECT20161130", - "original": "## Internationalization: pluralization and _select_ (2016-11-30)", - "translation": "## 国际化:单复数和 `select` (2016-11-30)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THEINTERNATIONALIZATIONI18NGUIDEI18NGUIDEEXPLAINSHOWTOHANDLEPLURALIZATIONANDTRANSLATIONOFALTERNATIVETEXTSWITHSELECTTHESAMPLEDEMONSTRATESTHESEFEATURESTOO", - "original": "The [Internationalization (i18n)](guide/i18n) guide explains how to handle pluralization and\ntranslation of alternative texts with `select`.\nThe sample demonstrates these features too.", - "translation": "[国际化 (i18n)](guide/i18n)解释了如何处理单复数问题,和如何使用 `select` 来翻译候选内容。\n例子中也演示了这些特性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##TESTING:KARMAFILEUPDATES20161130", - "original": "## Testing: karma file updates (2016-11-30)", - "translation": "## 测试:更新了 karma 文件 (2016-11-30)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "KARMACONFIGKARMATESTSHIMCANHANDLEMULTIPLESPECSOURCEPATHSSEEQUICKSTARTISSUE:ANGULARQUICKSTART#294HTTPS:GITHUBCOMANGULARQUICKSTARTISSUES294", - "original": "* `karma.config` + `karma-test-shim` can handle multiple spec source paths;\nsee quickstart issue: [angular/quickstart#294](https://github.com/angular/quickstart/issues/294).", - "translation": "`karma.config` + `karma-test-shim` 可以处理多个测试源文件路径了,参见[angular/quickstart#294](https://github.com/angular/quickstart/issues/294)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "DISPLAYSJASMINERUNNEROUTPUTINTHEKARMALAUNCHEDBROWSER", - "original": "* Displays Jasmine Runner output in the karma-launched browser.", - "translation": "在启动了 karma 的浏览器中显示 Jasmine 的输出。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##QUICKSTARTREWRITE20161118", - "original": "## QuickStart Rewrite (2016-11-18)", - "translation": "## 全新《快速上手》 (2016-11-18)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THEQUICKSTARTISCOMPLETELYREWRITTENSOTHATITACTUALLYISQUICKITREFERENCESAMINIMALHELLOANGULARAPPRUNNINGINPLUNKERTHENEWSETUPGUIDESETUPPAGETELLSYOUHOWTOINSTALLALOCALDEVELOPMENTENVIRONMENTBYDOWNLOADINGORCLONINGTHEQUICKSTARTGITHUBREPOSITORYYOUARENOLONGERASKEDTOCOPYANDPASTECODEINTOSETUPFILESTHATWERENOTEXPLAINEDANYWAY", - "original": "The QuickStart is completely rewritten so that it actually is quick.\nIt references a minimal \"Hello Angular\" app running in Plunker.\nThe new [Setup](guide/setup) page tells you how to install a local development environment\nby downloading (or cloning) the QuickStart github repository.\nYou are no longer asked to copy-and-paste code into setup files that were not explained anyway.", - "translation": "完全重写了《快速上手》,变得更加快速。\n它使用了在 Plunker 中运行的最小化的 “Hello Angular” 应用。\n新添加的[搭建本地开发环境](guide/setup)页面解释了如何通过下载或者克隆 QuickStart github 库来安装本地开发环境。\n你将不再需要拷贝粘贴代码到一些并没有对其解释的配置文件中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##SYNCWITHANGULARV22020161114", - "original": "## Sync with Angular v.2.2.0 (2016-11-14)", - "translation": "## 与 Angular v.2.2.0 同步(2016-11-14)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "DOCSANDCODESAMPLESUPDATEDANDTESTEDWITHANGULARV220", - "original": "Docs and code samples updated and tested with Angular v.2.2.0.", - "translation": "使用 Angular v.2.2.0 更新和测试所有文档和代码例子。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##UPDATE:NGUPGRADEGUIDEFORTHEAOTFRIENDLYUPGRADESTATICMODULE20161114", - "original": "## UPDATE: NgUpgrade Guide for the AOT friendly _upgrade/static_ module (2016-11-14)", - "translation": "## 更新:用于 AOT 的 *upgrade/static* 模块 NgUpgrade 指南 (2016-11-14)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THEUPDATEDNGUPGRADEGUIDEGUIDEUPGRADEGUIDECOVERSTHENEWAOTFRIENDLYUPGRADESTATICMODULERELEASEDINV220WHICHISTHERECOMMENDEDFACILITYFORMIGRATINGFROMANGULARJSTOANGULARTHEDOCUMENTATIONFORTHEVERSIONPRIORTOV220HASBEENREMOVED", - "original": "The updated [NgUpgrade Guide](guide/upgrade) guide covers the\nnew AOT friendly `upgrade/static` module\nreleased in v.2.2.0, which is the recommended\nfacility for migrating from AngularJS to Angular.\nThe documentation for the version prior to v.2.2.0 has been removed.", - "translation": "更新的[NgUpgrade 指南](guide/upgrade)涵盖在 v.2.2.0 发布的 AOT`upgrade/static` 模块,\n是从 AngularJS 升级至 Angular 的推荐工具。\n删除早于 v.2.2.0 版本的文档。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##ES6DESCRIBEDINTYPESCRIPTTOJAVASCRIPT20161114", - "original": "## ES6 described in \"TypeScript to JavaScript\" (2016-11-14)", - "translation": "## 在“从 TypeScript 到 JavaScript”增加 ES6 的描述 (2016-11-14)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THEUPDATEDTYPESCRIPTTOJAVASCRIPTGUIDEEXPLAINSHOWTOWRITEAPPSINES67BYTRANSLATINGTHECOMMONIDIOMSINTHETYPESCRIPTDOCUMENTATIONEXAMPLESANDELSEWHEREONTHEWEBTOES67ANDES5", - "original": "The updated TypeScript to JavaScript guide explains how to write apps in ES6/7\nby translating the common idioms in the TypeScript documentation examples\n(and elsewhere on the web) to ES6/7 and ES5.", - "translation": "更新了“从 TypeScript 到 JavaScript”,以解释如何使用 ES6/7 编写应用。\n将 TypeScript 文档示例中(以及网站其它地方)的习惯用法翻译成 ES6/7 和 ES5。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THISWASREMOVEDINAUGUST2017HTTPS:GITHUBCOMANGULARANGULARPULL18694BUTCANSTILLBEVIEWEDINTHEV2DOCUMENTATIONHTTPS:V2ANGULARIODOCSTSLATESTCOOKBOOKTSTOJSHTML", - "original": "This was [removed in August 2017](https://github.com/angular/angular/pull/18694) but can still be\nviewed in the [v2 documentation](https://v2.angular.io/docs/ts/latest/cookbook/ts-to-js.html).", - "translation": "本章已经 [于 2017 年 8 月移除](https://github.com/angular/angular/pull/18694),\n不过仍然可以在[第二版的文档中](https://v2.angular.cn/docs/ts/latest/cookbook/ts-to-js.html)看到。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##SYNCWITHANGULARV21120161021", - "original": "## Sync with Angular v.2.1.1 (2016-10-21)", - "translation": "## 与 Angular v.2.1.1 同步(2016-10-21)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "DOCSANDCODESAMPLESUPDATEDANDTESTEDWITHANGULARV211", - "original": "Docs and code samples updated and tested with Angular v.2.1.1.", - "translation": "使用 Angular v.2.1.1 更新和测试所有文档和代码例子。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##NPMTYPESPACKAGESREPLACETYPINGS20161020", - "original": "## npm _@types_ packages replace _typings_ (2016-10-20)", - "translation": "## 使用 npm 的_@types*包替换*typings_ (2016-10-20)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "DOCUMENTATIONSAMPLESNOWGETTYPESCRIPTTYPEINFORMATIONFOR3RDPARTYLIBRARIESFROMNPMTYPESPACKAGESRATHERTHANWITHTHETYPINGSTOOLINGTHETYPINGSJSONFILEISGONE", - "original": "Documentation samples now get TypeScript type information for 3rd party libraries\nfrom npm `@types` packages rather than with the _typings_ tooling.\nThe `typings.json` file is gone.", - "translation": "文档例子现在从 npm 的 `@types` 第三方库获取 TypeScript 类型信息,不再使用_typings_。\n删除 `typings.json` 文件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THEANGULARJSUPGRADEGUIDEUPGRADEGUIDEREFLECTSTHISCHANGETHEPACKAGEJSONINSTALLSTYPESANGULARANDSEVERALTYPESANGULARPACKAGESINSUPPORTOFUPGRADETHESEARENOTNEEDEDFORPUREANGULARDEVELOPMENT", - "original": "The [AngularJS Upgrade](guide/upgrade) guide reflects this change.\nThe `package.json` installs `@types/angular` and several `@types/angular-...`\npackages in support of upgrade; these are not needed for pure Angular development.", - "translation": "\"[从 AngularJS 升级](guide/upgrade)\"指南反映了这个变化。\n`package.json` 安装 `@types/angular` 和一些 `@types/angular-...` 包来支持升级。它们在纯 Angular 开发中是不需要的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##TEMPLATESYNTAXEXPLAINSTWOWAYDATABINDINGSYNTAX20161020", - "original": "## \"Template Syntax\" explains two-way data binding syntax (2016-10-20)", - "translation": "## \"模板语法\"添加了双向数据绑定语法的解释(2016-10-20)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "DEMONSTRATESHOWTOTWOWAYDATABINDTOACUSTOMANGULARCOMPONENTANDREEXPLAINSNGMODELINTERMSOFTHEBASICSYNTAX", - "original": "Demonstrates how to two-way data bind to a custom Angular component and\nre-explains `[(ngModel)]` in terms of the basic `[()]` syntax.", - "translation": "展示了如何在自定义 Angular 组件中双向数据绑定,用基础 `[()]` 重新解释 `[(ngModel)]`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##BREAKINGCHANGE:INMEMORYWEBAPIV0111DELIVEREDASESMUMD20161019", - "original": "## BREAKING CHANGE: `in-memory-web-api` (v.0.1.11) delivered as esm umd (2016-10-19)", - "translation": "## 破坏性变化:`in-memory-web-api` (v.0.1.11) 以 esm umd 的形式发布 (2016-10-19)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THISCHANGESUPPORTSES6DEVELOPERSANDALIGNSBETTERWITHTYPICALANGULARLIBRARIESITDOESNOTAFFECTTHEMODULESAPIBUTITDOESAFFECTHOWYOULOADANDIMPORTITSEETHEAHREFHTTPS:GITHUBCOMANGULARINMEMORYWEBAPIBLOBMASTERCHANGELOGMD#011320161020CHANGENOTEAINTHEINMEMORYWEBAPIREPO", - "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/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##ROUTERPRELOADSYNTAXAND:ENTER:LEAVEANIMATIONS20161019", - "original": "## \"Router\" _preload_ syntax and _:enter_/_:leave_ animations (2016-10-19)", - "translation": "## \"路由器\"*预加载*语法和 *:enter*/*:leave* 动画(2016-10-19)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THEROUTERCANLAZILYPRELOADMODULESAFTERTHEAPPSTARTSANDBEFORETHEUSERNAVIGATESTOTHEMFORIMPROVEDPERCEIVEDPERFORMANCE", - "original": "The router can lazily _preload_ modules _after_ the app starts and\n_before_ the user navigates to them for improved perceived performance.", - "translation": "路由器可以在应用启动*之后*和用户导航到惰性加载模块*之前*,预先加载惰性模块,以增强性能。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "NEW:ENTERAND:LEAVEALIASESMAKEANIMATIONMORENATURAL", - "original": "New `:enter` and `:leave` aliases make animation more natural.", - "translation": "新 `:enter` 和 `:leave` 语法,让动画更加自然。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##SYNCWITHANGULARV21020161012", - "original": "## Sync with Angular v.2.1.0 (2016-10-12)", - "translation": "## 与 Angular v.2.1.0 同步(2016-10-12)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "DOCSANDCODESAMPLESUPDATEDANDTESTEDWITHANGULARV210", - "original": "Docs and code samples updated and tested with Angular v.2.1.0.", - "translation": "使用 Angular v.2.1.0 更新和测试所有文档和代码例子。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##NEWAHEADOFTIMEAOTCOMPILATIONGUIDE20161011", - "original": "## NEW \"Ahead of time (AOT) Compilation\" guide (2016-10-11)", - "translation": "## 添加了新的“预编译(AOT)\" 指南(2016-10-11)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THENEWAHEADOFTIMEAOTCOMPILATIONGUIDEAOTCOMPILERGUIDEEXPLAINSWHATAOTCOMPILATIONISANDWHYYOUDWANTITITDEMONSTRATESTHEBASICSWITHAQUICKSTARTAPPFOLLOWEDBYTHEMOREADVANCEDCONSIDERATIONSOFCOMPILINGANDBUNDLINGTHETOUROFHEROES", - "original": "The NEW [Ahead of time (AOT) Compilation](guide/aot-compiler) guide\nexplains what AOT compilation is and why you'd want it.\nIt demonstrates the basics with a QuickStart app\nfollowed by the more advanced considerations of compiling and bundling the Tour of Heroes.", - "translation": "全新[预编译(AOT)](guide/aot-compiler)指南介绍了什么是 AOT 编译和为何你需要它。\n它以**快速上手**应用程序开始讲解,接着介绍了编译和构建**英雄指南**的更高级的注意事项。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##SYNCWITHANGULARV2022016106", - "original": "## Sync with Angular v.2.0.2 (2016-10-6)", - "translation": "## 与 Angular v.2.0.2 同步 (2016-10-6)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "DOCSANDCODESAMPLESUPDATEDANDTESTEDWITHANGULARV202", - "original": "Docs and code samples updated and tested with Angular v.2.0.2.", - "translation": "使用 Angular v.2.0.2 更新和测试所有文档和代码例子。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##ROUTINGANDNAVIGATIONGUIDEWITHTHEROUTERMODULE2016105", - "original": "## \"Routing and Navigation\" guide with the _Router Module_ (2016-10-5)", - "translation": "## 在“路由和导航”向导中添加**路由模块** (2016-10-5)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THEROUTINGANDNAVIGATIONGUIDEROUTERGUIDENOWLOCATESROUTECONFIGURATIONINAROUTINGMODULETHEROUTINGMODULEREPLACESTHEPREVIOUSROUTINGOBJECTINVOLVINGTHEMODULEWITHPROVIDERS", - "original": "The [Routing and Navigation](guide/router) guide now locates route configuration\nin a _Routing Module_.\nThe _Routing Module_ replaces the previous _routing object_ involving the `ModuleWithProviders`.", - "translation": "[Routing and Navigation](guide/router)现在在**路由模块**中设置路由配置。\n**路由模块**替换之前的**路由对象**,使用了 `ModuleWithProviders`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "ALLGUIDEDSAMPLESWITHROUTINGUSETHEROUTINGMODULEANDPROSECONTENTHASBEENUPDATEDMOSTCONSPICUOUSLYINTHENGMODULEGUIDENGMODULESGUIDEANDNGMODULEFAQGUIDENGMODULEFAQGUIDE", - "original": "All guided samples with routing use the _Routing Module_ and prose content has been updated,\nmost conspicuously in the\n[NgModule](guide/ngmodules) guide and [NgModule FAQ](guide/ngmodule-faq) guide.", - "translation": "所有使用路由的例子都使用**路由模块**,相关内容也被更新。更新最多的是[Angular 模块(NgModule)](guide/ngmodules)章和[Angular 模块常见问题](guide/ngmodule-faq)指南。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##NEWINTERNATIONALIZATIONGUIDE20160930", - "original": "## New \"Internationalization\" guide (2016-09-30)", - "translation": "## 全新“国际化”指南(2016-09-30)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "ADDEDANEWINTERNATIONALIZATIONI18NGUIDEI18NGUIDETHATSHOWSHOWTOUSEANGULARI18NFACILITIESTOTRANSLATETEMPLATETEXTINTOMULTIPLELANGUAGES", - "original": "Added a new [Internationalization (i18n)](guide/i18n) guide that shows how\nto use Angular \"i18n\" facilities to translate template text into multiple languages.", - "translation": "添加了新的[国际化(i18n)](guide/i18n)指南,展示了如何使用 Angular 的“i18n”工具来讲模板文本翻译到多种语言。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##ANGULARINMEMORYWEBAPIPACKAGERENAME20160927", - "original": "## \"angular-in-memory-web-api\" package rename (2016-09-27)", - "translation": "## 重命名“angular-in-memory-web-api”包(2016-09-27)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "MANYSAMPLESUSETHEANGULARINMEMORYWEBAPITOSIMULATEAREMOTESERVERTHISLIBRARYISALSOUSEFULTOYOUDURINGEARLYDEVELOPMENTBEFOREYOUHAVEASERVERTOTALKTO", - "original": "Many samples use the `angular-in-memory-web-api` to simulate a remote server.\nThis library is also useful to you during early development before you have a server to talk to.", - "translation": "许多例子使用了 `angular-in-memory-web-api` 来模拟远程服务器。\n这个库在你拥有服务器之前的早期开发阶段也很有用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THEPACKAGENAMEWASCHANGEDFROMANGULAR2INMEMORYWEBAPIWHICHISSTILLFROZENINTIMEONNPMTHENEWANGULARINMEMORYWEBAPIHASNEWFEATURESAHREFHTTPS:GITHUBCOMANGULARINMEMORYWEBAPIBLOBMASTERREADMEMDREADABOUTTHEMONGITHUBA", - "original": "The package name was changed from \"angular2-in-memory-web-api\" which is still frozen-in-time on npm.\nThe new \"angular-in-memory-web-api\" has new features.\nRead about them on github.", - "translation": "这个包的名字从“angular2-in-memory-web-api”(仍然有效,但不再更新了)重新命名了。\n新的“angular-in-memory-web-api”有新的功能。\n到 github 获得更多详情.", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##STYLEGUIDEWITHNGMODULES20160927", - "original": "## \"Style Guide\" with _NgModules_ (2016-09-27)", - "translation": "## “风格指南”中添加了_NgModules_(2016-09-27)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "STYLEGUIDEGUIDESTYLEGUIDEEXPLAINSRECOMMENDEDCONVENTIONSFORNGMODULESBARRELSNOWAREFARLESSUSEFULANDHAVEBEENREMOVEDFROMTHESTYLEGUIDETHEYREMAINVALUABLEBUTARENOTAMATTEROFANGULARSTYLEALSORELAXEDTHERULETHATDISCOURAGEDUSEOFTHECOMPONENTHOSTPROPERTY", - "original": "[StyleGuide](guide/styleguide) explains recommended conventions for NgModules.\nBarrels now are far less useful and have been removed from the style guide;\nthey remain valuable but are not a matter of Angular style.\nAlso relaxed the rule that discouraged use of the `@Component.host` property.", - "translation": "[StyleGuide](guide/styleguide)解释了 Angular 模块(NgModule)推荐的约定。\n现在,封装桶不再那么重要,风格指南已经移除了它们。\n它们仍然很有价值,但是它们与 Angular 风格无关。\n同时,**不推荐使用 `@Component.host` 属性**的规则也有所放宽。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##MODULEID:MODULEIDEVERYWHERE20160925", - "original": "## _moduleId: module.id_ everywhere (2016-09-25)", - "translation": "## moduleId:到处添加 module.id(2016-09-25)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "SAMPLECOMPONENTSTHATGETTHEIRTEMPLATESORSTYLESWITHTEMPLATEURLORSTYLEURLSHAVEBEENCONVERTEDTOMODULERELATIVEURLSADDEDTHEMODULEID:MODULEIDPROPERTYANDVALUETOTHEIRCOMPONENTMETADATA", - "original": "Sample components that get their templates or styles with `templateUrl` or `styleUrls`\nhave been converted to _module-relative_ URLs.\nAdded the `moduleId: module.id` property-and-value to their `@Component` metadata.", - "translation": "在所有使用 `templateUrl` 或者 `styleUrls` 来获取模板或样式的例子组件都被转换为**相对模块**的 URL。\n把 `moduleId: module.id` 添加到了它们的 `@Component` 元数据。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THISCHANGEISAREQUIREMENTFORCOMPILATIONWITHAOTCOMPILERWHENTHEAPPLOADSMODULESWITHSYSTEMJSASTHESAMPLESCURRENTLYDO", - "original": "This change is a requirement for compilation with AOT compiler when the app loads\nmodules with SystemJS as the samples currently do.", - "translation": "当应用像例子当前使用的方法一样 - 使用 SystemJS 加载模块时,本更新是 AOT 编译器的前提条件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "##LIFECYCLEHOOKSGUIDESIMPLIFIED20160924", - "original": "## \"Lifecycle Hooks\" guide simplified (2016-09-24)", - "translation": "## 简化了“生命周期钩子”章(2016-09-24)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "THELIFECYCLEHOOKSGUIDELIFECYCLEHOOKSGUIDEISSHORTERSIMPLERANDDRAWSMOREATTENTIONTOTHEORDERINWHICHANGULARCALLSTHEHOOKS", - "original": "The [Lifecycle Hooks](guide/lifecycle-hooks) guide is shorter, simpler, and\ndraws more attention to the order in which Angular calls the hooks.", - "translation": "[生命周期钩子](guide/lifecycle-hooks)章现在更加简短,并且对强调了 Angular 是以什么顺序来调用钩子方法的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/change-log.md" - }, - { - "key": "H1CLASSNOTOCCHEATSHEETH1", - "original": "

    Cheat Sheet

    ", - "translation": "

    速查表

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "BOOTSTRAPPING", - "original": "Bootstrapping", - "translation": "引导/启动", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBOOTSTRAPSTHEAPPUSINGTHEROOTCOMPONENTFROMTHESPECIFIEDCODENGMODULECODEP", - "original": "

    Bootstraps the app, using the root component from the specified NgModule.

    ", - "translation": "

    NgModule 中指定的根组件进行启动。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PDEFINESAMODULETHATCONTAINSCOMPONENTSDIRECTIVESPIPESANDPROVIDERSP", - "original": "

    Defines a module that contains components, directives, pipes, and providers.

    ", - "translation": "

    定义一个模块,其中可以包含组件、指令、管道和服务提供商。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PLISTOFCOMPONENTSDIRECTIVESANDPIPESTHATBELONGTOTHISMODULEP", - "original": "

    List of components, directives, and pipes that belong to this module.

    ", - "translation": "

    属于当前模块的组件、指令和管道的列表。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PLISTOFMODULESTOIMPORTINTOTHISMODULEEVERYTHINGFROMTHEIMPORTEDMODULESISAVAILABLETOCODEDECLARATIONSCODEOFTHISMODULEP", - "original": "

    List of modules to import into this module. Everything from the imported modules\nis available to declarations of this module.

    ", - "translation": "

    本模块所导入的模块列表

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PLISTOFCOMPONENTSDIRECTIVESANDPIPESVISIBLETOMODULESTHATIMPORTTHISMODULEP", - "original": "

    List of components, directives, and pipes visible to modules that import this module.

    ", - "translation": "

    那些导入了本模块的模块所能看到的组件、指令和管道的列表

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PLISTOFDEPENDENCYINJECTIONPROVIDERSVISIBLEBOTHTOTHECONTENTSOFTHISMODULEANDTOIMPORTERSOFTHISMODULEP", - "original": "

    List of dependency injection providers visible both to the contents of this module and to importers of this module.

    ", - "translation": "

    依赖注入提供商的列表,本模块以及本模块导入的所有模块中的内容都可以看见它们。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PLISTOFCOMPONENTSTOBOOTSTRAPWHENTHISMODULEISBOOTSTRAPPEDP", - "original": "

    List of components to bootstrap when this module is bootstrapped.

    ", - "translation": "

    当本模块启动时,随之启动的组件列表。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "TEMPLATESYNTAX", - "original": "Template syntax", - "translation": "模板语法", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSPROPERTYCODEVALUECODETOTHERESULTOFEXPRESSIONCODEFIRSTNAMECODEP", - "original": "

    Binds property value to the result of expression firstName.

    ", - "translation": "

    value属性绑定到表达式firstName

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSATTRIBUTECODEROLECODETOTHERESULTOFEXPRESSIONCODEMYARIAROLECODEP", - "original": "

    Binds attribute role to the result of expression myAriaRole.

    ", - "translation": "

    把属性(Attribute)role绑定到表达式myAriaRole的结果。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSTHEPRESENCEOFTHECSSCLASSCODEEXTRASPARKLECODEONTHEELEMENTTOTHETRUTHINESSOFTHEEXPRESSIONCODEISDELIGHTFULCODEP", - "original": "

    Binds the presence of the CSS class extra-sparkle on the element to the truthiness of the expression isDelightful.

    ", - "translation": "

    根据isDelightful表达式的结果是否为真,决定 CSS 类extra-sparkle是否出现在当前元素上。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSSTYLEPROPERTYCODEWIDTHCODETOTHERESULTOFEXPRESSIONCODEMYSIZECODEINPIXELSUNITSAREOPTIONALP", - "original": "

    Binds style property width to the result of expression mySize in pixels. Units are optional.

    ", - "translation": "

    把 CSS 样式属性width的 px(像素)值绑定到表达式mySize的结果。单位是可选的。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLSMETHODCODEREADRAINBOWCODEWHENACLICKEVENTISTRIGGEREDONTHISBUTTONELEMENTORITSCHILDRENANDPASSESINTHEEVENTOBJECTP", - "original": "

    Calls method readRainbow when a click event is triggered on this button element (or its children) and passes in the event object.

    ", - "translation": "

    当这个按钮元素(及其子元素)上的 click 事件触发时,调用方法readRainbow,并把这个事件对象作为参数传进去。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSAPROPERTYTOANINTERPOLATEDSTRINGFOREXAMPLEHELLOSEABISCUITEQUIVALENTTO:CODELTDIVTITLEHELLOPONYNAMEGTCODEP", - "original": "

    Binds a property to an interpolated string, for example, \"Hello Seabiscuit\". Equivalent to:\n<div [title]=\"'Hello ' + ponyName\">

    ", - "translation": "

    把一个属性绑定到插值字符串(如\"Hello Seabiscuit\")。这种写法等价于<div [title]=\"'Hello ' + ponyName\">

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSTEXTCONTENTTOANINTERPOLATEDSTRINGFOREXAMPLEHELLOSEABISCUITP", - "original": "

    Binds text content to an interpolated string, for example, \"Hello Seabiscuit\".

    ", - "translation": "

    把文本内容绑定到插值字符串(如\"Hello Seabiscuit\")

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PSETSUPTWOWAYDATABINDINGEQUIVALENTTO:CODELTMYCMPTITLENAMETITLECHANGENAMEEVENTGTCODEP", - "original": "

    Sets up two-way data binding. Equivalent to: <my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

    ", - "translation": "

    设置双向绑定。等价于<my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCREATESALOCALVARIABLECODEMOVIEPLAYERCODETHATPROVIDESACCESSTOTHECODEVIDEOCODEELEMENTINSTANCEINDATABINDINGANDEVENTBINDINGEXPRESSIONSINTHECURRENTTEMPLATEP", - "original": "

    Creates a local variable movieplayer that provides access to the video element instance in data-binding and event-binding expressions in the current template.

    ", - "translation": "

    创建一个局部变量movieplayer,支持在当前模板的数据绑定和事件绑定表达式中访问video元素的实例。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PTHECODECODESYMBOLTURNSTHECURRENTELEMENTINTOANEMBEDDEDTEMPLATEEQUIVALENTTO:CODELTNGTEMPLATEMYUNLESSMYEXPRESSIONGTLTPGTLTPGTLTNGTEMPLATEGTCODEP", - "original": "

    The * symbol turns the current element into an embedded template. Equivalent to:\n<ng-template [myUnless]=\"myExpression\"><p>...</p></ng-template>

    ", - "translation": "

    这个 * 符号会把当前元素转换成一个内嵌的模板。它等价于:\n<ng-template [myUnless]=\"myExpression\"><p>...</p></ng-template>

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PTRANSFORMSTHECURRENTVALUEOFEXPRESSIONCODECARDNUMBERCODEVIATHEPIPECALLEDCODEMYCARDNUMBERFORMATTERCODEP", - "original": "

    Transforms the current value of expression cardNumber via the pipe called myCardNumberFormatter.

    ", - "translation": "

    使用名叫myCardNumberFormatter的管道对表达式cardNumber的当前值进行变幻

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PTHESAFENAVIGATIONOPERATORCODECODEMEANSTHATTHECODEEMPLOYERCODEFIELDISOPTIONALANDIFCODEUNDEFINEDCODETHERESTOFTHEEXPRESSIONSHOULDBEIGNOREDP", - "original": "

    The safe navigation operator (?) means that the employer field is optional and if undefined, the rest of the expression should be ignored.

    ", - "translation": "

    安全导航操作符(?)表示employer字段是可选的,如果它是 undefined ,那么表达式其余的部分就会被忽略,并返回 undefined

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PANSVGSNIPPETTEMPLATENEEDSANCODESVG:CODEPREFIXONITSROOTELEMENTTODISAMBIGUATETHESVGELEMENTFROMANHTMLCOMPONENTP", - "original": "

    An SVG snippet template needs an svg: prefix on its root element to disambiguate the SVG element from an HTML component.

    ", - "translation": "

    模板中的 SVG 片段需要给它的根元素加上svg:前缀,以便把 SVG 元素和 HTML 元素区分开。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PANCODELTSVGGTCODEROOTELEMENTISDETECTEDASANSVGELEMENTAUTOMATICALLYWITHOUTTHEPREFIXP", - "original": "

    An <svg> root element is detected as an SVG element automatically, without the prefix.

    ", - "translation": "

    <svg>作为根元素时会自动识别为 SVG 元素,不需要前缀。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "BUILTINDIRECTIVES", - "original": "Built-in directives", - "translation": "内置指令", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PREMOVESORRECREATESAPORTIONOFTHEDOMTREEBASEDONTHECODESHOWSECTIONCODEEXPRESSIONP", - "original": "

    Removes or recreates a portion of the DOM tree based on the showSection expression.

    ", - "translation": "

    根据showSection表达式的结果,移除或重新创建 DOM 树的一部分。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PTURNSTHELIELEMENTANDITSCONTENTSINTOATEMPLATEANDUSESTHATTOINSTANTIATEAVIEWFOREACHITEMINLISTP", - "original": "

    Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list.

    ", - "translation": "

    把 li 元素及其内容变成一个模板,并使用这个模板为列表中的每一个条目实例化一个视图。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCONDITIONALLYSWAPSTHECONTENTSOFTHEDIVBYSELECTINGONEOFTHEEMBEDDEDTEMPLATESBASEDONTHECURRENTVALUEOFCODECONDITIONEXPRESSIONCODEP", - "original": "

    Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of conditionExpression.

    ", - "translation": "

    根据conditionExpression的当前值选择一个嵌入式模板,并用它替换这个 div 的内容。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSTHEPRESENCEOFCSSCLASSESONTHEELEMENTTOTHETRUTHINESSOFTHEASSOCIATEDMAPVALUESTHERIGHTHANDEXPRESSIONSHOULDRETURNCLASSNAME:TRUEFALSEMAPP", - "original": "

    Binds the presence of CSS classes on the element to the truthiness of the associated map values. The right-hand expression should return {class-name: true/false} map.

    ", - "translation": "

    根据 map 中的 value 是否为真,来决定该元素上是否出现与 name 对应的 CSS 类。右侧的表达式应该返回一个形如 {class-name: true/false} 的 map。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PALLOWSYOUTOASSIGNSTYLESTOANHTMLELEMENTUSINGCSSYOUCANUSECSSDIRECTLYASINTHEFIRSTEXAMPLEORYOUCANCALLAMETHODFROMTHECOMPONENTP", - "original": "

    Allows you to assign styles to an HTML element using CSS. You can use CSS directly, as in the first example, or you can call a method from the component.

    ", - "translation": "

    允许你使用 CSS 为 HTML 元素指定样式。你可以像第一个例子那样直接使用 CSS,也可以调用组件中的方法。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "FORMS", - "original": "Forms", - "translation": "表单", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PPROVIDESTWOWAYDATABINDINGPARSINGANDVALIDATIONFORFORMCONTROLSP", - "original": "

    Provides two-way data-binding, parsing, and validation for form controls.

    ", - "translation": "

    为表单控件提供双向数据绑定、解析和验证功能。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "CLASSDECORATORS", - "original": "Class decorators", - "translation": "类装饰器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PDECLARESTHATACLASSISACOMPONENTANDPROVIDESMETADATAABOUTTHECOMPONENTP", - "original": "

    Declares that a class is a component and provides metadata about the component.

    ", - "translation": "

    声明一个类是组件,并提供该组件的元数据。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PDECLARESTHATACLASSISADIRECTIVEANDPROVIDESMETADATAABOUTTHEDIRECTIVEP", - "original": "

    Declares that a class is a directive and provides metadata about the directive.

    ", - "translation": "

    声明一个类是指令,并提供该指令的元数据。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PDECLARESTHATACLASSISAPIPEANDPROVIDESMETADATAABOUTTHEPIPEP", - "original": "

    Declares that a class is a pipe and provides metadata about the pipe.

    ", - "translation": "

    声明一个类是管道,并提供该管道的元数据。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PDECLARESTHATACLASSHASDEPENDENCIESTHATSHOULDBEINJECTEDINTOTHECONSTRUCTORWHENTHEDEPENDENCYINJECTORISCREATINGANINSTANCEOFTHISCLASSP", - "original": "

    Declares that a class has dependencies that should be injected into the constructor when the dependency injector is creating an instance of this class.

    ", - "translation": "

    声明某个类具有一些依赖。当依赖注入器要创建这个类的实例时,应该把这些依赖注入到它的构造函数中。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "DIRECTIVECONFIGURATION", - "original": "Directive configuration", - "translation": "指令配置项", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PSPECIFIESACSSSELECTORTHATIDENTIFIESTHISDIRECTIVEWITHINATEMPLATESUPPORTEDSELECTORSINCLUDECODEELEMENTCODECODEATTRIBUTECODECODECLASSCODEANDCODE:NOTCODEP", - "original": "

    Specifies a CSS selector that identifies this directive within a template. Supported selectors include element,\n[attribute], .class, and :not().

    ", - "translation": "

    指定一个 CSS 选择器,用于在模板中标记出该指令。支持的选择器类型包括:元素名[属性名], .类名:not()

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PDOESNOTSUPPORTPARENTCHILDRELATIONSHIPSELECTORSP", - "original": "

    Does not support parent-child relationship selectors.

    ", - "translation": "

    但不支持指定父子关系的选择器。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PLISTOFDEPENDENCYINJECTIONPROVIDERSFORTHISDIRECTIVEANDITSCHILDRENP", - "original": "

    List of dependency injection providers for this directive and its children.

    ", - "translation": "

    该指令及其子指令的依赖注入提供商列表。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "COMPONENTCONFIGURATION", - "original": "Component configuration", - "translation": "组件配置项", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCODECOMPONENTCODEEXTENDSCODEDIRECTIVECODESOTHECODEDIRECTIVECODECONFIGURATIONAPPLIESTOCOMPONENTSASWELLP", - "original": "

    \n@Component extends @Directive,\nso the @Directive configuration applies to components as well

    ", - "translation": "

    @Component 继承自 @Directive,\n 因此,@Directive 的这些配置项也同样适用于组件。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PIFSETTHECODETEMPLATEURLCODEANDCODESTYLEURLCODEARERESOLVEDRELATIVETOTHECOMPONENTP", - "original": "

    If set, the templateUrl and styleUrl are resolved relative to the component.

    ", - "translation": "

    如果设置了,那么 templateUrlstyleUrl 的路径就会相对于当前组件进行解析。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PLISTOFDEPENDENCYINJECTIONPROVIDERSSCOPEDTOTHISCOMPONENTSVIEWP", - "original": "

    List of dependency injection providers scoped to this component's view.

    ", - "translation": "

    依赖注入提供商列表,但它们的范围被限定为当前组件的视图。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PINLINETEMPLATEOREXTERNALTEMPLATEURLOFTHECOMPONENTSVIEWP", - "original": "

    Inline template or external template URL of the component's view.

    ", - "translation": "

    当前组件视图的内联模板或外部模板的 URL 。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PLISTOFINLINECSSSTYLESOREXTERNALSTYLESHEETURLSFORSTYLINGTHECOMPONENTSVIEWP", - "original": "

    List of inline CSS styles or external stylesheet URLs for styling the component’s view.

    ", - "translation": "

    用于为当前组件的视图提供样式的内联 CSS 或外部样式表 URL 的列表。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "CLASSFIELDDECORATORSFORDIRECTIVESANDCOMPONENTS", - "original": "Class field decorators for directives and components", - "translation": "给指令和组件使用的类属性配置项", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PDECLARESANINPUTPROPERTYTHATYOUCANUPDATEVIAPROPERTYBINDINGEXAMPLE:CODELTMYCMPMYPROPERTYSOMEEXPRESSIONGTCODEP", - "original": "

    Declares an input property that you can update via property binding (example:\n<my-cmp [myProperty]=\"someExpression\">).

    ", - "translation": "

    声明一个输入属性,你可以通过属性绑定来更新它,如 <my-cmp [myProperty]=\"someExpression\">

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PDECLARESANOUTPUTPROPERTYTHATFIRESEVENTSTHATYOUCANSUBSCRIBETOWITHANEVENTBINDINGEXAMPLE:CODELTMYCMPMYEVENTDOSOMETHINGGTCODEP", - "original": "

    Declares an output property that fires events that you can subscribe to with an event binding (example: <my-cmp (myEvent)=\"doSomething()\">).

    ", - "translation": "

    声明一个输出属性,它发出事件,你可以用事件绑定来订阅它们(如:<my-cmp (myEvent)=\"doSomething()\">)。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSAHOSTELEMENTPROPERTYHERETHECSSCLASSCODEVALIDCODETOADIRECTIVECOMPONENTPROPERTYCODEISVALIDCODEP", - "original": "

    Binds a host element property (here, the CSS class valid) to a directive/component property (isValid).

    ", - "translation": "

    把宿主元素的一个属性(这里是 CSS 类 valid)绑定到指令或组件上的 isValid 属性。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PSUBSCRIBESTOAHOSTELEMENTEVENTCODECLICKCODEWITHADIRECTIVECOMPONENTMETHODCODEONCLICKCODEOPTIONALLYPASSINGANARGUMENTCODEEVENTCODEP", - "original": "

    Subscribes to a host element event (click) with a directive/component method (onClick), optionally passing an argument ($event).

    ", - "translation": "

    用指令或组件上的onClick方法订阅宿主元素上的click事件,并从中获取$event参数(可选)

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSTHEFIRSTRESULTOFTHECOMPONENTCONTENTQUERYCODEMYPREDICATECODETOAPROPERTYCODEMYCHILDCOMPONENTCODEOFTHECLASSP", - "original": "

    Binds the first result of the component content query (myPredicate) to a property (myChildComponent) of the class.

    ", - "translation": "

    把组件内容查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSTHERESULTSOFTHECOMPONENTCONTENTQUERYCODEMYPREDICATECODETOAPROPERTYCODEMYCHILDCOMPONENTSCODEOFTHECLASSP", - "original": "

    Binds the results of the component content query (myPredicate) to a property (myChildComponents) of the class.

    ", - "translation": "

    把组件内容查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSTHEFIRSTRESULTOFTHECOMPONENTVIEWQUERYCODEMYPREDICATECODETOAPROPERTYCODEMYCHILDCOMPONENTCODEOFTHECLASSNOTAVAILABLEFORDIRECTIVESP", - "original": "

    Binds the first result of the component view query (myPredicate) to a property (myChildComponent) of the class. Not available for directives.

    ", - "translation": "

    把组件视图查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。对指令无效。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PBINDSTHERESULTSOFTHECOMPONENTVIEWQUERYCODEMYPREDICATECODETOAPROPERTYCODEMYCHILDCOMPONENTSCODEOFTHECLASSNOTAVAILABLEFORDIRECTIVESP", - "original": "

    Binds the results of the component view query (myPredicate) to a property (myChildComponents) of the class. Not available for directives.

    ", - "translation": "

    把组件视图查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上。对指令无效。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "DIRECTIVEANDCOMPONENTCHANGEDETECTIONANDLIFECYCLEHOOKS", - "original": "Directive and component change detection and lifecycle hooks", - "translation": "指令与组件的变更检测与生命周期钩子", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PIMPLEMENTEDASCLASSMETHODSP", - "original": "

    (implemented as class methods)

    ", - "translation": "

    由类的方法实现。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLEDBEFOREANYOTHERLIFECYCLEHOOKUSEITTOINJECTDEPENDENCIESBUTAVOIDANYSERIOUSWORKHEREP", - "original": "

    Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.

    ", - "translation": "

    在任何其它生命周期钩子之前调用。可以用它来注入依赖项,但不要在这里做正事。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLEDAFTEREVERYCHANGETOINPUTPROPERTIESANDBEFOREPROCESSINGCONTENTORCHILDVIEWSP", - "original": "

    Called after every change to input properties and before processing content or child views.

    ", - "translation": "

    每当输入属性发生变化时就会调用,但位于处理内容(ng-content)或子视图之前。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLEDAFTERTHECONSTRUCTORINITIALIZINGINPUTPROPERTIESANDTHEFIRSTCALLTOCODENGONCHANGESCODEP", - "original": "

    Called after the constructor, initializing input properties, and the first call to ngOnChanges.

    ", - "translation": "

    在调用完构造函数、初始化完所有输入属性并首次调用过ngOnChanges之后调用。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLEDEVERYTIMETHATTHEINPUTPROPERTIESOFACOMPONENTORADIRECTIVEARECHECKEDUSEITTOEXTENDCHANGEDETECTIONBYPERFORMINGACUSTOMCHECKP", - "original": "

    Called every time that the input properties of a component or a directive are checked. Use it to extend change detection by performing a custom check.

    ", - "translation": "

    每当对组件或指令的输入属性进行变更检测时就会调用。可以用它来扩展变更检测逻辑,执行自定义的检测逻辑。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLEDAFTERCODENGONINITCODEWHENTHECOMPONENTSORDIRECTIVESCONTENTHASBEENINITIALIZEDP", - "original": "

    Called after ngOnInit when the component's or directive's content has been initialized.

    ", - "translation": "

    ngOnInit完成之后,当组件或指令的内容(ng-content)已经初始化完毕时调用。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLEDAFTEREVERYCHECKOFTHECOMPONENTSORDIRECTIVESCONTENTP", - "original": "

    Called after every check of the component's or directive's content.

    ", - "translation": "

    每当组件或指令的内容(ng-content)做变更检测时调用。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLEDAFTERCODENGAFTERCONTENTINITCODEWHENTHECOMPONENTSVIEWSANDCHILDVIEWSTHEVIEWTHATADIRECTIVEISINHASBEENINITIALIZEDP", - "original": "

    Called after ngAfterContentInit when the component's views and child views / the view that a directive is in has been initialized.

    ", - "translation": "

    ngAfterContentInit完毕,并且组件的视图及其子视图或指令所属的视图已经初始化完毕时调用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLEDAFTEREVERYCHECKOFTHECOMPONENTSVIEWSANDCHILDVIEWSTHEVIEWTHATADIRECTIVEISINP", - "original": "

    Called after every check of the component's views and child views / the view that a directive is in.

    ", - "translation": "

    当组件的视图及其子视图或指令所属的视图每次执行变更检测时调用。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCALLEDONCEBEFORETHEINSTANCEISDESTROYEDP", - "original": "

    Called once, before the instance is destroyed.

    ", - "translation": "

    只在实例被销毁前调用一次。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "DEPENDENCYINJECTIONCONFIGURATION", - "original": "Dependency injection configuration", - "translation": "依赖注入配置项", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PSETSOROVERRIDESTHEPROVIDERFORCODEMYSERVICECODETOTHECODEMYMOCKSERVICECODECLASSP", - "original": "

    Sets or overrides the provider for MyService to the MyMockService class.

    ", - "translation": "

    MyService 的服务提供商设置或改写为 MyMockService 类。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PSETSOROVERRIDESTHEPROVIDERFORCODEMYSERVICECODETOTHECODEMYFACTORYCODEFACTORYFUNCTIONP", - "original": "

    Sets or overrides the provider for MyService to the myFactory factory function.

    ", - "translation": "

    MyService 的服务提供商设置或改写为 myFactory 工厂函数。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PSETSOROVERRIDESTHEPROVIDERFORCODEMYVALUECODETOTHEVALUECODE41CODEP", - "original": "

    Sets or overrides the provider for MyValue to the value 41.

    ", - "translation": "

    MyValue 的服务提供商改写为一个特定的值 41

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "ROUTINGANDNAVIGATION", - "original": "Routing and navigation", - "translation": "路由与导航", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCONFIGURESROUTESFORTHEAPPLICATIONSUPPORTSSTATICPARAMETERIZEDREDIRECTANDWILDCARDROUTESALSOSUPPORTSCUSTOMROUTEDATAANDRESOLVEP", - "original": "

    Configures routes for the application. Supports static, parameterized, redirect, and wildcard routes. Also supports custom route data and resolve.

    ", - "translation": "

    为该应用配置路由。支持静态、参数化、重定向和通配符路由。也支持自定义路由数据和解析(resolve)函数。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PMARKSTHELOCATIONTOLOADTHECOMPONENTOFTHEACTIVEROUTEP", - "original": "

    Marks the location to load the component of the active route.

    ", - "translation": "

    标记出一个位置,用来加载活动路由的组件。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PCREATESALINKTOADIFFERENTVIEWBASEDONAROUTEINSTRUCTIONCONSISTINGOFAROUTEPATHREQUIREDANDOPTIONALPARAMETERSQUERYPARAMETERSANDAFRAGMENTTONAVIGATETOAROOTROUTEUSETHECODECODEPREFIXFORACHILDROUTEUSETHECODECODEPREFIXFORASIBLINGORPARENTUSETHECODECODEPREFIXP", - "original": "

    Creates a link to a different view based on a route instruction consisting of a route path, required and optional parameters, query parameters, and a fragment. To navigate to a root route, use the / prefix; for a child route, use the ./prefix; for a sibling or parent, use the ../ prefix.

    ", - "translation": "

    使用路由体系创建一个到其它视图的链接。路由体系由路由路径、必要参数、可选参数、查询参数和文档片段组成。要导航到根路由,请使用/前缀;要导航到子路由,使用./前缀;要导航到兄弟路由或父级路由,使用../前缀。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PTHEPROVIDEDCLASSESAREADDEDTOTHEELEMENTWHENTHECODEROUTERLINKCODEBECOMESTHECURRENTACTIVEROUTEP", - "original": "

    The provided classes are added to the element when the routerLink becomes the current active route.

    ", - "translation": "

    routerLink 指向的路由变成活动路由时,为当前元素添加一些类(比如这里的 active)。

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PANINTERFACEFORDEFININGACLASSTHATTHEROUTERSHOULDCALLFIRSTTODETERMINEIFITSHOULDACTIVATETHISCOMPONENTSHOULDRETURNABOOLEANORANOBSERVABLEPROMISETHATRESOLVESTOABOOLEANP", - "original": "

    An interface for defining a class that the router should call first to determine if it should activate this component. Should return a boolean or an Observable/Promise that resolves to a boolean.

    ", - "translation": "

    用来定义类的接口。路由器会首先调用本接口来决定是否激活该路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PANINTERFACEFORDEFININGACLASSTHATTHEROUTERSHOULDCALLFIRSTTODETERMINEIFITSHOULDDEACTIVATETHISCOMPONENTAFTERANAVIGATIONSHOULDRETURNABOOLEANORANOBSERVABLEPROMISETHATRESOLVESTOABOOLEANP", - "original": "

    An interface for defining a class that the router should call first to determine if it should deactivate this component after a navigation. Should return a boolean or an Observable/Promise that resolves to a boolean.

    ", - "translation": "

    用来定义类的接口。路由器会在导航离开前首先调用本接口以决定是否取消激活本路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PANINTERFACEFORDEFININGACLASSTHATTHEROUTERSHOULDCALLFIRSTTODETERMINEIFITSHOULDACTIVATETHECHILDROUTESHOULDRETURNABOOLEANORANOBSERVABLEPROMISETHATRESOLVESTOABOOLEANP", - "original": "

    An interface for defining a class that the router should call first to determine if it should activate the child route. Should return a boolean or an Observable/Promise that resolves to a boolean.

    ", - "translation": "

    用来定义类的接口。路由器会首先调用本接口来决定是否激活一个子路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PANINTERFACEFORDEFININGACLASSTHATTHEROUTERSHOULDCALLFIRSTTORESOLVEROUTEDATABEFORERENDERINGTHEROUTESHOULDRETURNAVALUEORANOBSERVABLEPROMISETHATRESOLVESTOAVALUEP", - "original": "

    An interface for defining a class that the router should call first to resolve route data before rendering the route. Should return a value or an Observable/Promise that resolves to a value.

    ", - "translation": "

    用来定义类的接口。路由器会在渲染该路由之前,首先调用它来解析路由数据。应该返回一个值或能解析成值的 Observable/Promise

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "PANINTERFACEFORDEFININGACLASSTHATTHEROUTERSHOULDCALLFIRSTTOCHECKIFTHELAZYLOADEDMODULESHOULDBELOADEDSHOULDRETURNABOOLEANORANOBSERVABLEPROMISETHATRESOLVESTOABOOLEANP", - "original": "

    An interface for defining a class that the router should call first to check if the lazy loaded module should be loaded. Should return a boolean or an Observable/Promise that resolves to a boolean.

    ", - "translation": "

    用来定义类的接口。路由器会首先调用它来决定是否应该加载一个惰性加载模块。应该返回一个 boolean 或能解析成 booleanObservable/Promise

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" - }, - { - "key": "#OBSERVABLESCOMPAREDTOOTHERTECHNIQUES", - "original": "# Observables compared to other techniques", - "translation": "# 可观察对象与其它技术的比较", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "YOUCANOFTENUSEOBSERVABLESINSTEADOFPROMISESTODELIVERVALUESASYNCHRONOUSLYSIMILARLYOBSERVABLESCANTAKETHEPLACEOFEVENTHANDLERSFINALLYBECAUSEOBSERVABLESDELIVERMULTIPLEVALUESYOUCANUSETHEMWHEREYOUMIGHTOTHERWISEBUILDANDOPERATEONARRAYS", - "original": "You can often use observables instead of promises to deliver values asynchronously. Similarly, observables can take the place of event handlers. Finally, because observables deliver multiple values, you can use them where you might otherwise build and operate on arrays.", - "translation": "你可以经常使用可观察对象(Observable)而不是承诺(Promise)来异步传递值。\n类似的,可观察对象也可以取代事件处理器的位置。最后,由于可观察对象传递多个值,所以你可以在任何可能构建和操作数组的地方使用可观察对象。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESBEHAVESOMEWHATDIFFERENTLYFROMTHEALTERNATIVETECHNIQUESINEACHOFTHESESITUATIONSBUTOFFERSOMESIGNIFICANTADVANTAGESHEREAREDETAILEDCOMPARISONSOFTHEDIFFERENCES", - "original": "Observables behave somewhat differently from the alternative techniques in each of these situations, but offer some significant advantages. Here are detailed comparisons of the differences.", - "translation": "在这些情况下,可观察对象的行为与其替代技术有一些差异,不过也提供了一些显著的优势。下面是对这些差异的详细比较。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "##OBSERVABLESCOMPAREDTOPROMISES", - "original": "## Observables compared to promises", - "translation": "## 可观察对象 vs. 承诺", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESAREOFTENCOMPAREDTOPROMISESHEREARESOMEKEYDIFFERENCES:", - "original": "Observables are often compared to promises. Here are some key differences:", - "translation": "可观察对象经常拿来和承诺进行对比。有一些关键的不同点:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESAREDECLARATIVECOMPUTATIONDOESNOTSTARTUNTILSUBSCRIPTIONPROMISESEXECUTEIMMEDIATELYONCREATIONTHISMAKESOBSERVABLESUSEFULFORDEFININGRECIPESTHATCANBERUNWHENEVERYOUNEEDTHERESULT", - "original": "* Observables are declarative; computation does not start until subscription. Promises execute immediately on creation. This makes observables useful for defining recipes that can be run whenever you need the result.", - "translation": "可观察对象是声明式的,在被订阅之前,它不会开始执行。承诺是在创建时就立即执行的。这让可观察对象可用于定义那些应该按需执行的菜谱。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESPROVIDEMANYVALUESPROMISESPROVIDEONETHISMAKESOBSERVABLESUSEFULFORGETTINGMULTIPLEVALUESOVERTIME", - "original": "* Observables provide many values. Promises provide one. This makes observables useful for getting multiple values over time.", - "translation": "可观察对象能提供多个值。承诺只提供一个。这让可观察对象可用于随着时间的推移获取多个值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESDIFFERENTIATEBETWEENCHAININGANDSUBSCRIPTIONPROMISESONLYHAVETHENCLAUSESTHISMAKESOBSERVABLESUSEFULFORCREATINGCOMPLEXTRANSFORMATIONRECIPESTOBEUSEDBYOTHERPARTOFTHESYSTEMWITHOUTCAUSINGTHEWORKTOBEEXECUTED", - "original": "* Observables differentiate between chaining and subscription. Promises only have `.then()` clauses. This makes observables useful for creating complex transformation recipes to be used by other part of the system, without causing the work to be executed.", - "translation": "可观察对象会区分串联处理和订阅语句。承诺只有 `.then()` 语句。这让可观察对象可用于创建供系统的其它部分使用而不希望立即执行的复杂菜谱。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESSUBSCRIBEISRESPONSIBLEFORHANDLINGERRORSPROMISESPUSHERRORSTOTHECHILDPROMISESTHISMAKESOBSERVABLESUSEFULFORCENTRALIZEDANDPREDICTABLEERRORHANDLING", - "original": "* Observables `subscribe()` is responsible for handling errors. Promises push errors to the child promises. This makes observables useful for centralized and predictable error handling.", - "translation": "可观察对象的 `subscribe()` 会负责处理错误。承诺会把错误推送给它的子承诺。这让可观察对象可用于进行集中式、可预测的错误处理。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "###CREATIONANDSUBSCRIPTION", - "original": "### Creation and subscription", - "translation": "### 创建与订阅", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESARENOTEXECUTEDUNTILACONSUMERSUBCRIBESTHESUBSCRIBEEXECUTESTHEDEFINEDBEHAVIORONCEANDITCANBECALLEDAGAINEACHSUBSCRIPTIONHASITSOWNCOMPUTATIONRESUBSCRIPTIONCAUSESRECOMPUTATIONOFVALUES", - "original": "* Observables are not executed until a consumer subcribes. The `subscribe()` executes the defined behavior once, and it can be called again. Each subscription has its own computation. Resubscription causes recomputation of values.", - "translation": "在有消费者订阅之前,可观察对象不会执行。`subscribe()` 会执行一次定义好的行为,并且可以再次调用它。每次订阅都是单独计算的。重新订阅会导致重新计算这些值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "PROMISESEXECUTEIMMEDIATELYANDJUSTONCETHECOMPUTATIONOFTHERESULTISINITIATEDWHENTHEPROMISEISCREATEDTHEREISNOWAYTORESTARTWORKALLTHENCLAUSESSUBSCRIPTIONSSHARETHESAMECOMPUTATION", - "original": "* Promises execute immediately, and just once. The computation of the result is initiated when the promise is created. There is no way to restart work. All `then` clauses (subscriptions) share the same computation.", - "translation": "承诺会立即执行,并且只执行一次。当承诺创建时,会立即计算出结果。没有办法重新做一次。所有的 `then` 语句(订阅)都会共享同一次计算。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "###CHAINING", - "original": "### Chaining", - "translation": "### 串联", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESDIFFERENTIATEBETWEENTRANSFORMATIONFUNCTIONSUCHASAMAPANDSUBSCRIPTIONONLYSUBSCRIPTIONACTIVATESTHESUBSCRIBERFUNCTIONTOSTARTCOMPUTINGTHEVALUES", - "original": "* Observables differentiate between transformation function such as a map and subscription. Only subscription activates the subscriber function to start computing the values.", - "translation": "可观察对象会区分各种转换函数,比如映射和订阅。只有订阅才会激活订阅者函数,以开始计算那些值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "PROMISESDONOTDIFFERENTIATEBETWEENTHELASTTHENCLAUSESEQUIVALENTTOSUBSCRIPTIONANDINTERMEDIATETHENCLAUSESEQUIVALENTTOMAP", - "original": "* Promises do not differentiate between the last `.then` clauses (equivalent to subscription) and intermediate `.then` clauses (equivalent to map).", - "translation": "承诺并不区分最后的 `.then()` 语句(等价于订阅)和中间的 `.then()` 语句(等价于映射)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "###CANCELLATION", - "original": "### Cancellation", - "translation": "### 可取消", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESUBSCRIPTIONSARECANCELLABLEUNSUBSCRIBINGREMOVESTHELISTENERFROMRECEIVINGFURTHERVALUESANDNOTIFIESTHESUBSCRIBERFUNCTIONTOCANCELWORK", - "original": "* Observable subscriptions are cancellable. Unsubscribing removes the listener from receiving further values, and notifies the subscriber function to cancel work.", - "translation": "可观察对象的订阅是可取消的。取消订阅会移除监听器,使其不再接受将来的值,并通知订阅者函数取消正在进行的工作。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "PROMISESARENOTCANCELLABLE", - "original": "* Promises are not cancellable.", - "translation": "承诺是不可取消的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "###ERRORHANDLING", - "original": "### Error handling", - "translation": "### 错误处理", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLEEXECUTIONERRORSAREDELIVEREDTOTHESUBSCRIBERSERRORHANDLERANDTHESUBSCRIBERAUTOMATICALLYUNSUBSCRIBESFROMTHEOBSERVABLE", - "original": "* Observable execution errors are delivered to the subscriber's error handler, and the subscriber automatically unsubscribes from the observable.", - "translation": "可观察对象的错误处理是交给订阅者的错误处理器的,并且该订阅者会自动取消对这个可观察对象的订阅。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "PROMISESPUSHERRORSTOTHECHILDPROMISES", - "original": "* Promises push errors to the child promises.", - "translation": "承诺会把错误推给其子承诺。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "###CHEATSHEET", - "original": "### Cheat sheet", - "translation": "### 速查表", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "THEFOLLOWINGCODESNIPPETSILLUSTRATEHOWTHESAMEKINDOFOPERATIONISDEFINEDUSINGOBSERVABLESANDPROMISES", - "original": "The following code snippets illustrate how the same kind of operation is defined using observables and promises.", - "translation": "下列代码片段揭示了同样的操作要如何分别使用可观察对象和承诺进行实现。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OPERATION", - "original": "Operation", - "translation": "操作", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLE", - "original": "Observable", - "translation": "可观察对象", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "PROMISE", - "original": "Promise", - "translation": "承诺", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "CREATION", - "original": "Creation", - "translation": "创建", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "TRANSFORM", - "original": "Transform", - "translation": "转换", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "SUBSCRIBE", - "original": "Subscribe", - "translation": "订阅", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "UNSUBSCRIBE", - "original": "Unsubscribe", - "translation": "取消订阅", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "IMPLIEDBYPROMISERESOLUTION", - "original": "Implied by promise resolution.", - "translation": "承诺被解析时隐式完成。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "##OBSERVABLESCOMPAREDTOEVENTSAPI", - "original": "## Observables compared to events API", - "translation": "## 可观察对象 vs. 事件 API", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLESAREVERYSIMILARTOEVENTHANDLERSTHATUSETHEEVENTSAPIBOTHTECHNIQUESDEFINENOTIFICATIONHANDLERSANDUSETHEMTOPROCESSMULTIPLEVALUESDELIVEREDOVERTIMESUBSCRIBINGTOANOBSERVABLEISEQUIVALENTTOADDINGANEVENTLISTENERONESIGNIFICANTDIFFERENCEISTHATYOUCANCONFIGUREANOBSERVABLETOTRANSFORMANEVENTBEFOREPASSINGTHEEVENTTOTHEHANDLER", - "original": "Observables are very similar to event handlers that use the events API. Both techniques define notification handlers, and use them to process multiple values delivered over time. Subscribing to an observable is equivalent to adding an event listener. One significant difference is that you can configure an observable to transform an event before passing the event to the handler.", - "translation": "可观察对象和事件 API 中的事件处理器很像。这两种技术都会定义通知处理器,并使用它们来处理一段时间内传递的多个值。订阅可观察对象与添加事件处理器是等价的。一个显著的不同是你可以配置可观察对象,使其在把事件传给事件处理器之间先进行转换。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "USINGOBSERVABLESTOHANDLEEVENTSANDASYNCHRONOUSOPERATIONSCANHAVETHEADVANTAGEOFGREATERCONSISTENCYINCONTEXTSSUCHASHTTPREQUESTS", - "original": "Using observables to handle events and asynchronous operations can have the advantage of greater consistency in contexts such as HTTP requests.", - "translation": "使用可观察对象来处理错误和异步操作在 HTTP 请求这样的场景下更加具有一致性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "HEREARESOMECODESAMPLESTHATILLUSTRATEHOWTHESAMEKINDOFOPERATIONISDEFINEDUSINGOBSERVABLESANDTHEEVENTSAPI", - "original": "Here are some code samples that illustrate how the same kind of operation is defined using observables and the events API.", - "translation": "下列代码片段揭示了同样的操作要如何分别使用可观察对象和事件 API 进行实现。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLE", - "original": "Observable", - "translation": "可观察对象", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "EVENTSAPI", - "original": "Events API", - "translation": "事件 API", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "CREATIONCANCELLATION", - "original": "Creation & cancellation", - "translation": "创建与取消", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "SUBSCRIPTION", - "original": "Subscription", - "translation": "订阅", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "CONFIGURATION", - "original": "Configuration", - "translation": "配置", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "LISTENFORKEYSTROKESBUTPROVIDEASTREAMREPRESENTINGTHEVALUEINTHEINPUT", - "original": "Listen for keystrokes, but provide a stream representing the value in the input.", - "translation": "监听按键,提供一个流来表示这些输入的值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "DOESNOTSUPPORTCONFIGURATION", - "original": "Does not support configuration.", - "translation": "不支持配置。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "##OBSERVABLESCOMPAREDTOARRAYS", - "original": "## Observables compared to arrays", - "translation": "## 可观察对象 vs. 数组", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "ANOBSERVABLEPRODUCESVALUESOVERTIMEANARRAYISCREATEDASASTATICSETOFVALUESINASENSEOBSERVABLESAREASYNCHRONOUSWHEREARRAYSARESYNCHRONOUSINTHEFOLLOWINGEXAMPLESIMPLIESASYNCHRONOUSVALUEDELIVERY", - "original": "An observable produces values over time. An array is created as a static set of values. In a sense, observables are asynchronous where arrays are synchronous. In the following examples, ➞ implies asynchronous value delivery.", - "translation": "可观察对象会随时间生成值。数组是用一组静态的值创建的。某种意义上,可观察对象是异步的,而数组是同步的。\n在下列例子中,➞ 符号表示异步传递值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "OBSERVABLE", - "original": "Observable", - "translation": "可观察对象", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "ARRAY", - "original": "Array", - "translation": "数组", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "GIVEN", - "original": "Given", - "translation": "给出值", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/comparing-observables.md" - }, - { - "key": "#COMPONENTINTERACTION", - "original": "# Component Interaction", - "translation": "# 组件之间的交互", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THISCOOKBOOKCONTAINSRECIPESFORCOMMONCOMPONENTCOMMUNICATIONSCENARIOSINWHICHTWOORMORECOMPONENTSSHAREINFORMATION", - "original": "This cookbook contains recipes for common component communication scenarios\nin which two or more components share information.", - "translation": "本烹饪宝典包含了常见的组件通讯场景,也就是让两个或多个组件之间共享信息的方法。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "#CONTENTS", - "original": "# Contents", - "translation": "# 目录", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "PASSDATAFROMPARENTTOCHILDWITHINPUTBINDINGGUIDECOMPONENTINTERACTION#PARENTTOCHILD", - "original": "* [Pass data from parent to child with input binding](guide/component-interaction#parent-to-child)", - "translation": "[使用输入绑定把数据从父组件传给子组件](guide/component-interaction#parent-to-child)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "INTERCEPTINPUTPROPERTYCHANGESWITHASETTERGUIDECOMPONENTINTERACTION#PARENTTOCHILDSETTER", - "original": "* [Intercept input property changes with a setter](guide/component-interaction#parent-to-child-setter)", - "translation": "[使用赋值器(setter)拦截输入属性的变化](guide/component-interaction#parent-to-child-setter)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "INTERCEPTINPUTPROPERTYCHANGESWITHNGONCHANGESGUIDECOMPONENTINTERACTION#PARENTTOCHILDONCHANGES", - "original": "* [Intercept input property changes with `ngOnChanges()`](guide/component-interaction#parent-to-child-on-changes)", - "translation": "[使用 `ngOnChanges()` 拦截输入属性的变化](guide/component-interaction#parent-to-child-on-changes)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "PARENTCALLSANVIEWCHILDGUIDECOMPONENTINTERACTION#PARENTTOVIEWCHILD", - "original": "* [Parent calls an `@ViewChild()`](guide/component-interaction#parent-to-view-child)", - "translation": "[在父组件中调用 `@ViewChild()`](guide/component-interaction#parent-to-view-child)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "PARENTANDCHILDRENCOMMUNICATEVIAASERVICEGUIDECOMPONENTINTERACTION#BIDIRECTIONALSERVICE", - "original": "* [Parent and children communicate via a service](guide/component-interaction#bidirectional-service)", - "translation": "[通过服务进行父子通讯](guide/component-interaction#bidirectional-service)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "SEETHELIVEEXAMPLENAMECOMPONENTINTERACTIONLIVEEXAMPLE", - "original": "**See the **.", - "translation": "**参见**。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "##PASSDATAFROMPARENTTOCHILDWITHINPUTBINDING", - "original": "## Pass data from parent to child with input binding", - "translation": "## 通过输入型绑定把数据从父组件传到子组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "HEROCHILDCOMPONENTHASTWOINPUTPROPERTIESTYPICALLYADORNEDWITHINPUTDECORATIONSGUIDETEMPLATESYNTAX#INPUTSOUTPUTS", - "original": "`HeroChildComponent` has two ***input properties***,\ntypically adorned with [@Input decorations](guide/template-syntax#inputs-outputs).", - "translation": "`HeroChildComponent` 有两个***输入型属性***,它们通常带[@Input 装饰器](guide/template-syntax#inputs-outputs)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THESECONDINPUTALIASESTHECHILDCOMPONENTPROPERTYNAMEMASTERNAMEASMASTER", - "original": "The second `@Input` aliases the child component property name `masterName` as `'master'`.", - "translation": "第二个 `@Input` 为子组件的属性名 `masterName` 指定一个别名 `master`(译者注:不推荐为起别名,请参见风格指南).", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEHEROPARENTCOMPONENTNESTSTHECHILDHEROCHILDCOMPONENTINSIDEANNGFORREPEATERBINDINGITSMASTERSTRINGPROPERTYTOTHECHILDSMASTERALIASANDEACHITERATIONSHEROINSTANCETOTHECHILDSHEROPROPERTY", - "original": "The `HeroParentComponent` nests the child `HeroChildComponent` inside an `*ngFor` repeater,\nbinding its `master` string property to the child's `master` alias,\nand each iteration's `hero` instance to the child's `hero` property.", - "translation": "父组件 `HeroParentComponent` 把子组件的 `HeroChildComponent` 放到 `*ngFor` 循环器中,把自己的 `master` 字符串属性绑定到子组件的 `master` 别名上,并把每个循环的 `hero` 实例绑定到子组件的 `hero` 属性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THERUNNINGAPPLICATIONDISPLAYSTHREEHEROES:", - "original": "The running application displays three heroes:", - "translation": "运行应用程序会显示三个英雄:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "H3CLASSNOTOCTESTITH3", - "original": "

    Test it

    ", - "translation": "

    测试一下!

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "E2ETESTTHATALLCHILDRENWEREINSTANTIATEDANDDISPLAYEDASEXPECTED:", - "original": "E2E test that all children were instantiated and displayed as expected:", - "translation": "端到端测试,用于确保所有的子组件都像所期待的那样被初始化并显示出来。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "BACKTOTOPGUIDECOMPONENTINTERACTION#TOP", - "original": "[Back to top](guide/component-interaction#top)", - "translation": "[回到顶部](guide/component-interaction#top)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "##INTERCEPTINPUTPROPERTYCHANGESWITHASETTER", - "original": "## Intercept input property changes with a setter", - "translation": "## 通过 setter 截听输入属性值的变化", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "USEANINPUTPROPERTYSETTERTOINTERCEPTANDACTUPONAVALUEFROMTHEPARENT", - "original": "Use an input property setter to intercept and act upon a value from the parent.", - "translation": "使用一个输入属性的 setter,以拦截父组件中值的变化,并采取行动。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THESETTEROFTHENAMEINPUTPROPERTYINTHECHILDNAMECHILDCOMPONENTTRIMSTHEWHITESPACEFROMANAMEANDREPLACESANEMPTYVALUEWITHDEFAULTTEXT", - "original": "The setter of the `name` input property in the child `NameChildComponent`\ntrims the whitespace from a name and replaces an empty value with default text.", - "translation": "子组件 `NameChildComponent` 的输入属性 `name` 上的这个 setter,会 trim 掉名字里的空格,并把空值替换成默认字符串。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "HERESTHENAMEPARENTCOMPONENTDEMONSTRATINGNAMEVARIATIONSINCLUDINGANAMEWITHALLSPACES:", - "original": "Here's the `NameParentComponent` demonstrating name variations including a name with all spaces:", - "translation": "下面的 `NameParentComponent` 展示了各种名字的处理方式,包括一个全是空格的名字。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "H3CLASSNOTOCTESTITH3", - "original": "

    Test it

    ", - "translation": "

    测试一下!

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "E2ETESTSOFINPUTPROPERTYSETTERWITHEMPTYANDNONEMPTYNAMES:", - "original": "E2E tests of input property setter with empty and non-empty names:", - "translation": "端到端测试:输入属性的 setter,分别使用空名字和非空名字。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "BACKTOTOPGUIDECOMPONENTINTERACTION#TOP", - "original": "[Back to top](guide/component-interaction#top)", - "translation": "[回到顶部](guide/component-interaction#top)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "##INTERCEPTINPUTPROPERTYCHANGESWITHNGONCHANGES", - "original": "## Intercept input property changes with *ngOnChanges()*", - "translation": "## 通过*ngOnChanges()*来截听输入属性值的变化", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "DETECTANDACTUPONCHANGESTOINPUTPROPERTYVALUESWITHTHENGONCHANGESMETHODOFTHEONCHANGESLIFECYCLEHOOKINTERFACE", - "original": "Detect and act upon changes to input property values with the `ngOnChanges()` method of the `OnChanges` lifecycle hook interface.", - "translation": "使用 `OnChanges` 生命周期钩子接口的 `ngOnChanges()` 方法来监测输入属性值的变化并做出回应。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "YOUMAYPREFERTHISAPPROACHTOTHEPROPERTYSETTERWHENWATCHINGMULTIPLEINTERACTINGINPUTPROPERTIES", - "original": "You may prefer this approach to the property setter when watching multiple, interacting input properties.", - "translation": "当需要监视多个、交互式输入属性的时候,本方法比用属性的 setter 更合适。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "LEARNABOUTNGONCHANGESINTHELIFECYCLEHOOKSGUIDELIFECYCLEHOOKSCHAPTER", - "original": "Learn about `ngOnChanges()` in the [LifeCycle Hooks](guide/lifecycle-hooks) chapter.", - "translation": "学习关于 `ngOnChanges()` 的更多知识,参见[生命周期钩子](guide/lifecycle-hooks)一章。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THISVERSIONCHILDCOMPONENTDETECTSCHANGESTOTHEMAJORANDMINORINPUTPROPERTIESANDCOMPOSESALOGMESSAGEREPORTINGTHESECHANGES:", - "original": "This `VersionChildComponent` detects changes to the `major` and `minor` input properties and composes a log message reporting these changes:", - "translation": "这个 `VersionChildComponent` 会监测输入属性 `major` 和 `minor` 的变化,并把这些变化编写成日志以报告这些变化。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEVERSIONPARENTCOMPONENTSUPPLIESTHEMINORANDMAJORVALUESANDBINDSBUTTONSTOMETHODSTHATCHANGETHEM", - "original": "The `VersionParentComponent` supplies the `minor` and `major` values and binds buttons to methods that change them.", - "translation": "`VersionParentComponent` 提供 `minor` 和 `major` 值,把修改它们值的方法绑定到按钮上。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "HERESTHEOUTPUTOFABUTTONPUSHINGSEQUENCE:", - "original": "Here's the output of a button-pushing sequence:", - "translation": "下面是点击按钮的结果。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "H3CLASSNOTOCTESTITH3", - "original": "

    Test it

    ", - "translation": "

    测试一下!

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "TESTTHATBOTHINPUTPROPERTIESARESETINITIALLYANDTHATBUTTONCLICKSTRIGGERTHEEXPECTEDNGONCHANGESCALLSANDVALUES:", - "original": "Test that ***both*** input properties are set initially and that button clicks trigger\nthe expected `ngOnChanges` calls and values:", - "translation": "测试确保***这两个***输入属性值都被初始化了,当点击按钮后,`ngOnChanges` 应该被调用,属性的值也符合预期。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "BACKTOTOPGUIDECOMPONENTINTERACTION#TOP", - "original": "[Back to top](guide/component-interaction#top)", - "translation": "[回到顶部](guide/component-interaction#top)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "##PARENTLISTENSFORCHILDEVENT", - "original": "## Parent listens for child event", - "translation": "## 父组件监听子组件的事件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THECHILDCOMPONENTEXPOSESANEVENTEMITTERPROPERTYWITHWHICHITEMITSEVENTSWHENSOMETHINGHAPPENSTHEPARENTBINDSTOTHATEVENTPROPERTYANDREACTSTOTHOSEEVENTS", - "original": "The child component exposes an `EventEmitter` property with which it `emits` events when something happens.\nThe parent binds to that event property and reacts to those events.", - "translation": "子组件暴露一个 `EventEmitter` 属性,当事件发生时,子组件利用该属性 `emits`(向上弹射)事件。父组件绑定到这个事件属性,并在事件发生时作出回应。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THECHILDSEVENTEMITTERPROPERTYISANOUTPUTPROPERTYTYPICALLYADORNEDWITHANOUTPUTDECORATIONGUIDETEMPLATESYNTAX#INPUTSOUTPUTSASSEENINTHISVOTERCOMPONENT:", - "original": "The child's `EventEmitter` property is an ***output property***,\n typically adorned with an [@Output decoration](guide/template-syntax#inputs-outputs)\n as seen in this `VoterComponent`:", - "translation": "子组件的 `EventEmitter` 属性是一个**输出属性**,通常带有[@Output 装饰器](guide/template-syntax#inputs-outputs),就像在 `VoterComponent` 中看到的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "CLICKINGABUTTONTRIGGERSEMISSIONOFATRUEORFALSETHEBOOLEANPAYLOAD", - "original": "Clicking a button triggers emission of a `true` or `false`, the boolean *payload*.", - "translation": "点击按钮会触发 `true` 或 `false`(布尔型*有效载荷*)的事件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEPARENTVOTETAKERCOMPONENTBINDSANEVENTHANDLERCALLEDONVOTEDTHATRESPONDSTOTHECHILDEVENTPAYLOADEVENTANDUPDATESACOUNTER", - "original": "The parent `VoteTakerComponent` binds an event handler called `onVoted()` that responds to the child event\npayload `$event` and updates a counter.", - "translation": "父组件 `VoteTakerComponent` 绑定了一个事件处理器(`onVoted()`),用来响应子组件的事件(`$event`)并更新一个计数器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEFRAMEWORKPASSESTHEEVENTARGUMENTMDASHREPRESENTEDBYEVENTMDASHTOTHEHANDLERMETHODANDTHEMETHODPROCESSESIT:", - "original": "The framework passes the event argument—represented by `$event`—to the handler method,\nand the method processes it:", - "translation": "框架(Angular)把事件参数(用 `$event` 表示)传给事件处理方法,这个方法会处理:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "H3CLASSNOTOCTESTITH3", - "original": "

    Test it

    ", - "translation": "

    测试一下!

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "TESTTHATCLICKINGTHEAGREEANDDISAGREEBUTTONSUPDATETHEAPPROPRIATECOUNTERS:", - "original": "Test that clicking the *Agree* and *Disagree* buttons update the appropriate counters:", - "translation": "测试确保点击 *Agree* 和 *Disagree* 按钮时,计数器被正确更新。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "BACKTOTOPGUIDECOMPONENTINTERACTION#TOP", - "original": "[Back to top](guide/component-interaction#top)", - "translation": "[回到顶部](guide/component-interaction#top)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "##PARENTINTERACTSWITHCHILDVIALOCALVARIABLE", - "original": "## Parent interacts with child via *local variable*", - "translation": "## 父组件与子组件通过*本地变量*互动", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "APARENTCOMPONENTCANNOTUSEDATABINDINGTOREADCHILDPROPERTIESORINVOKECHILDMETHODSYOUCANDOBOTHBYCREATINGATEMPLATEREFERENCEVARIABLEFORTHECHILDELEMENTANDTHENREFERENCETHATVARIABLEWITHINTHEPARENTTEMPLATEASSEENINTHEFOLLOWINGEXAMPLE", - "original": "A parent component cannot use data binding to read child properties\nor invoke child methods. You can do both\nby creating a template reference variable for the child element\nand then reference that variable *within the parent template*\nas seen in the following example.", - "translation": "父组件不能使用数据绑定来读取子组件的属性或调用子组件的方法。但可以在父组件模板里,新建一个本地变量来代表子组件,然后利用这个变量来读取子组件的属性和调用子组件的方法,如下例所示。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEFOLLOWINGISACHILDCOUNTDOWNTIMERCOMPONENTTHATREPEATEDLYCOUNTSDOWNTOZEROANDLAUNCHESAROCKETITHASSTARTANDSTOPMETHODSTHATCONTROLTHECLOCKANDITDISPLAYSACOUNTDOWNSTATUSMESSAGEINITSOWNTEMPLATE", - "original": "The following is a child `CountdownTimerComponent` that repeatedly counts down to zero and launches a rocket.\nIt has `start` and `stop` methods that control the clock and it displays a\ncountdown status message in its own template.", - "translation": "子组件 `CountdownTimerComponent` 进行倒计时,归零时发射一个导弹。`start` 和 `stop` 方法负责控制时钟并在模板里显示倒计时的状态信息。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THECOUNTDOWNLOCALVARPARENTCOMPONENTTHATHOSTSTHETIMERCOMPONENTISASFOLLOWS:", - "original": "The `CountdownLocalVarParentComponent` that hosts the timer component is as follows:", - "translation": "计时器组件的宿主组件 `CountdownLocalVarParentComponent` 如下:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEPARENTCOMPONENTCANNOTDATABINDTOTHECHILDSSTARTANDSTOPMETHODSNORTOITSSECONDSPROPERTY", - "original": "The parent component cannot data bind to the child's\n`start` and `stop` methods nor to its `seconds` property.", - "translation": "父组件不能通过数据绑定使用子组件的 `start` 和 `stop` 方法,也不能访问子组件的 `seconds` 属性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "YOUCANPLACEALOCALVARIABLE#TIMERONTHETAGCOUNTDOWNTIMERREPRESENTINGTHECHILDCOMPONENTTHATGIVESYOUAREFERENCETOTHECHILDCOMPONENTANDTHEABILITYTOACCESSANYOFITSPROPERTIESORMETHODSFROMWITHINTHEPARENTTEMPLATE", - "original": "You can place a local variable, `#timer`, on the tag `` representing the child component.\nThat gives you a reference to the child component and the ability to access\n*any of its properties or methods* from within the parent template.", - "translation": "把本地变量(`#timer`)放到(``)标签中,用来代表子组件。这样父组件的模板就得到了子组件的引用,于是可以在父组件的模板中访问子组件的所有属性和方法。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THISEXAMPLEWIRESPARENTBUTTONSTOTHECHILDSSTARTANDSTOPANDUSESINTERPOLATIONTODISPLAYTHECHILDSSECONDSPROPERTY", - "original": "This example wires parent buttons to the child's `start` and `stop` and\nuses interpolation to display the child's `seconds` property.", - "translation": "这个例子把父组件的按钮绑定到子组件的 `start` 和 `stop` 方法,并用插值表达式来显示子组件的 `seconds` 属性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "HEREWESEETHEPARENTANDCHILDWORKINGTOGETHER", - "original": "Here we see the parent and child working together.", - "translation": "下面是父组件和子组件一起工作时的效果。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "H3CLASSNOTOCTESTITH3", - "original": "

    Test it

    ", - "translation": "

    测试一下!

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "TESTTHATTHESECONDSDISPLAYEDINTHEPARENTTEMPLATEMATCHTHESECONDSDISPLAYEDINTHECHILDSSTATUSMESSAGETESTALSOTHATCLICKINGTHESTOPBUTTONPAUSESTHECOUNTDOWNTIMER:", - "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* 按钮来停止倒计时:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "BACKTOTOPGUIDECOMPONENTINTERACTION#TOP", - "original": "[Back to top](guide/component-interaction#top)", - "translation": "[回到顶部](guide/component-interaction#top)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "##PARENTCALLSANVIEWCHILD", - "original": "## Parent calls an _@ViewChild()_", - "translation": "## 父组件调用*@ViewChild()*", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THELOCALVARIABLEAPPROACHISSIMPLEANDEASYBUTITISLIMITEDBECAUSETHEPARENTCHILDWIRINGMUSTBEDONEENTIRELYWITHINTHEPARENTTEMPLATETHEPARENTCOMPONENTITSELFHASNOACCESSTOTHECHILD", - "original": "The *local variable* approach is simple and easy. But it is limited because\nthe parent-child wiring must be done entirely within the parent template.\nThe parent component *itself* has no access to the child.", - "translation": "这个*本地变量*方法是个简单便利的方法。但是它也有局限性,因为父组件-子组件的连接必须全部在父组件的模板中进行。父组件本身的代码对子组件没有访问权。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "YOUCANTUSETHELOCALVARIABLETECHNIQUEIFANINSTANCEOFTHEPARENTCOMPONENTCLASSMUSTREADORWRITECHILDCOMPONENTVALUESORMUSTCALLCHILDCOMPONENTMETHODS", - "original": "You can't use the *local variable* technique if an instance of the parent component *class*\nmust read or write child component values or must call child component methods.", - "translation": "如果父组件的*类*需要读取子组件的属性值或调用子组件的方法,就不能使用*本地变量*方法。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "WHENTHEPARENTCOMPONENTCLASSREQUIRESTHATKINDOFACCESSINJECTTHECHILDCOMPONENTINTOTHEPARENTASAVIEWCHILD", - "original": "When the parent component *class* requires that kind of access,\n***inject*** the child component into the parent as a *ViewChild*.", - "translation": "当父组件*类*需要这种访问时,可以把子组件作为 *ViewChild*,***注入***到父组件里面。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEFOLLOWINGEXAMPLEILLUSTRATESTHISTECHNIQUEWITHTHESAMECOUNTDOWNTIMERGUIDECOMPONENTINTERACTION#COUNTDOWNTIMEREXAMPLEEXAMPLENEITHERITSAPPEARANCENORITSBEHAVIORWILLCHANGETHECHILDCOUNTDOWNTIMERCOMPONENTGUIDECOMPONENTINTERACTION#COUNTDOWNTIMEREXAMPLEISTHESAMEASWELL", - "original": "The following example illustrates this technique with the same\n[Countdown Timer](guide/component-interaction#countdown-timer-example) example.\nNeither its appearance nor its behavior will change.\nThe child [CountdownTimerComponent](guide/component-interaction#countdown-timer-example) is the same as well.", - "translation": "下面的例子用与[倒计时](guide/component-interaction#countdown-timer-example)相同的范例来解释这种技术。\n它的外观或行为没有变化。子组件[CountdownTimerComponent](guide/component-interaction#countdown-timer-example)也和原来一样。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THESWITCHFROMTHELOCALVARIABLETOTHEVIEWCHILDTECHNIQUEISSOLELYFORTHEPURPOSEOFDEMONSTRATION", - "original": "The switch from the *local variable* to the *ViewChild* technique\nis solely for the purpose of demonstration.", - "translation": "由*本地变量*切换到 *ViewChild* 技术的唯一目的就是做示范。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "HEREISTHEPARENTCOUNTDOWNVIEWCHILDPARENTCOMPONENT:", - "original": "Here is the parent, `CountdownViewChildParentComponent`:", - "translation": "下面是父组件 `CountdownViewChildParentComponent`:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "ITTAKESABITMOREWORKTOGETTHECHILDVIEWINTOTHEPARENTCOMPONENTCLASS", - "original": "It takes a bit more work to get the child view into the parent component *class*.", - "translation": "把子组件的视图插入到父组件类需要做一点额外的工作。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "FIRSTYOUHAVETOIMPORTREFERENCESTOTHEVIEWCHILDDECORATORANDTHEAFTERVIEWINITLIFECYCLEHOOK", - "original": "First, you have to import references to the `ViewChild` decorator and the `AfterViewInit` lifecycle hook.", - "translation": "首先,你要使用 `ViewChild` 装饰器导入这个引用,并挂上 `AfterViewInit` 生命周期钩子。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "NEXTINJECTTHECHILDCOUNTDOWNTIMERCOMPONENTINTOTHEPRIVATETIMERCOMPONENTPROPERTYVIATHEVIEWCHILDPROPERTYDECORATION", - "original": "Next, inject the child `CountdownTimerComponent` into the private `timerComponent` property\nvia the `@ViewChild` property decoration.", - "translation": "接着,通过 `@ViewChild` 属性装饰器,将子组件 `CountdownTimerComponent` 注入到私有属性 `timerComponent` 里面。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THE#TIMERLOCALVARIABLEISGONEFROMTHECOMPONENTMETADATAINSTEADBINDTHEBUTTONSTOTHEPARENTCOMPONENTSOWNSTARTANDSTOPMETHODSANDPRESENTTHETICKINGSECONDSINANINTERPOLATIONAROUNDTHEPARENTCOMPONENTSSECONDSMETHOD", - "original": "The `#timer` local variable is gone from the component metadata.\nInstead, bind the buttons to the parent component's own `start` and `stop` methods and\npresent the ticking seconds in an interpolation around the parent component's `seconds` method.", - "translation": "组件元数据里就不再需要 `#timer` 本地变量了。而是把按钮绑定到父组件自己的 `start` 和 `stop` 方法,使用父组件的 `seconds` 方法的插值表达式来展示秒数变化。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THESEMETHODSACCESSTHEINJECTEDTIMERCOMPONENTDIRECTLY", - "original": "These methods access the injected timer component directly.", - "translation": "这些方法可以直接访问被注入的计时器组件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THENGAFTERVIEWINITLIFECYCLEHOOKISANIMPORTANTWRINKLETHETIMERCOMPONENTISNTAVAILABLEUNTILAFTERANGULARDISPLAYSTHEPARENTVIEWSOITDISPLAYS0SECONDSINITIALLY", - "original": "The `ngAfterViewInit()` lifecycle hook is an important wrinkle.\nThe timer component isn't available until *after* Angular displays the parent view.\nSo it displays `0` seconds initially.", - "translation": "`ngAfterViewInit()` 生命周期钩子是非常重要的一步。被注入的计时器组件只有在 Angular 显示了父组件视图之后才能访问,所以它先把秒数显示为 0.", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THENANGULARCALLSTHENGAFTERVIEWINITLIFECYCLEHOOKATWHICHTIMEITISTOOLATETOUPDATETHEPARENTVIEWSDISPLAYOFTHECOUNTDOWNSECONDSANGULARSUNIDIRECTIONALDATAFLOWRULEPREVENTSUPDATINGTHEPARENTVIEWSINTHESAMECYCLETHEAPPHASTOWAITONETURNBEFOREITCANDISPLAYTHESECONDS", - "original": "Then Angular calls the `ngAfterViewInit` lifecycle hook at which time it is *too late*\nto update the parent view's display of the countdown seconds.\nAngular's unidirectional data flow rule prevents updating the parent view's\nin the same cycle. The app has to *wait one turn* before it can display the seconds.", - "translation": "然后 Angular 会调用 `ngAfterViewInit` 生命周期钩子,但这时候再更新父组件视图的倒计时就已经太晚了。Angular 的单向数据流规则会阻止在同一个周期内更新父组件视图。应用在显示秒数之前会被迫*再等一轮*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "USESETTIMEOUTTOWAITONETICKANDTHENREVISETHESECONDSMETHODSOTHATITTAKESFUTUREVALUESFROMTHETIMERCOMPONENT", - "original": "Use `setTimeout()` to wait one tick and then revise the `seconds()` method so\nthat it takes future values from the timer component.", - "translation": "使用 `setTimeout()` 来等下一轮,然后改写 `seconds()` 方法,这样它接下来就会从注入的这个计时器组件里获取秒数的值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "H3CLASSNOTOCTESTITH3", - "original": "

    Test it

    ", - "translation": "

    测试一下!

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "USETHESAMECOUNTDOWNTIMERTESTSGUIDECOMPONENTINTERACTION#COUNTDOWNTESTSASBEFORE", - "original": "Use [the same countdown timer tests](guide/component-interaction#countdown-tests) as before.", - "translation": "使用和之前[一样的倒计时测试](guide/component-interaction#countdown-tests)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "BACKTOTOPGUIDECOMPONENTINTERACTION#TOP", - "original": "[Back to top](guide/component-interaction#top)", - "translation": "[回到顶部](guide/component-interaction#top)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "##PARENTANDCHILDRENCOMMUNICATEVIAASERVICE", - "original": "## Parent and children communicate via a service", - "translation": "## 父组件和子组件通过服务来通讯", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "APARENTCOMPONENTANDITSCHILDRENSHAREASERVICEWHOSEINTERFACEENABLESBIDIRECTIONALCOMMUNICATIONWITHINTHEFAMILY", - "original": "A parent component and its children share a service whose interface enables bi-directional communication\n*within the family*.", - "translation": "父组件和它的子组件共享同一个服务,利用该服务*在家庭内部*实现双向通讯。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THESCOPEOFTHESERVICEINSTANCEISTHEPARENTCOMPONENTANDITSCHILDRENCOMPONENTSOUTSIDETHISCOMPONENTSUBTREEHAVENOACCESSTOTHESERVICEORTHEIRCOMMUNICATIONS", - "original": "The scope of the service instance is the parent component and its children.\nComponents outside this component subtree have no access to the service or their communications.", - "translation": "该服务实例的作用域被限制在父组件和其子组件内。这个组件子树之外的组件将无法访问该服务或者与它们通讯。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THISMISSIONSERVICECONNECTSTHEMISSIONCONTROLCOMPONENTTOMULTIPLEASTRONAUTCOMPONENTCHILDREN", - "original": "This `MissionService` connects the `MissionControlComponent` to multiple `AstronautComponent` children.", - "translation": "这个 `MissionService` 把 `MissionControlComponent` 和多个 `AstronautComponent` 子组件连接起来。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEMISSIONCONTROLCOMPONENTBOTHPROVIDESTHEINSTANCEOFTHESERVICETHATITSHARESWITHITSCHILDRENTHROUGHTHEPROVIDERSMETADATAARRAYANDINJECTSTHATINSTANCEINTOITSELFTHROUGHITSCONSTRUCTOR:", - "original": "The `MissionControlComponent` both provides the instance of the service that it shares with its children\n(through the `providers` metadata array) and injects that instance into itself through its constructor:", - "translation": "`MissionControlComponent` 提供服务的实例,并将其共享给它的子组件(通过 `providers` 元数据数组),子组件可以通过构造函数将该实例注入到自身。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEASTRONAUTCOMPONENTALSOINJECTSTHESERVICEINITSCONSTRUCTOREACHASTRONAUTCOMPONENTISACHILDOFTHEMISSIONCONTROLCOMPONENTANDTHEREFORERECEIVESITSPARENTSSERVICEINSTANCE:", - "original": "The `AstronautComponent` also injects the service in its constructor.\nEach `AstronautComponent` is a child of the `MissionControlComponent` and therefore receives its parent's service instance:", - "translation": "`AstronautComponent` 也通过自己的构造函数注入该服务。由于每个 `AstronautComponent` 都是 `MissionControlComponent` 的子组件,所以它们获取到的也是父组件的这个服务实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "NOTICETHATTHISEXAMPLECAPTURESTHESUBSCRIPTIONANDUNSUBSCRIBEWHENTHEASTRONAUTCOMPONENTISDESTROYEDTHISISAMEMORYLEAKGUARDSTEPTHEREISNOACTUALRISKINTHISAPPBECAUSETHELIFETIMEOFAASTRONAUTCOMPONENTISTHESAMEASTHELIFETIMEOFTHEAPPITSELFTHATWOULDNOTALWAYSBETRUEINAMORECOMPLEXAPPLICATION", - "original": "Notice that this example captures the `subscription` and `unsubscribe()` when the `AstronautComponent` is destroyed.\nThis is a memory-leak guard step. There is no actual risk in this app because the\nlifetime of a `AstronautComponent` is the same as the lifetime of the app itself.\nThat *would not* always be true in a more complex application.", - "translation": "注意,这个例子保存了 `subscription` 变量,并在 `AstronautComponent` 被销毁时调用 `unsubscribe()` 退订。\n这是一个用于防止内存泄漏的保护措施。实际上,在这个应用程序中并没有这个风险,因为 `AstronautComponent` 的生命期和应用程序的生命期一样长。但在更复杂的应用程序环境中就不一定了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "YOUDONTADDTHISGUARDTOTHEMISSIONCONTROLCOMPONENTBECAUSEASTHEPARENTITCONTROLSTHELIFETIMEOFTHEMISSIONSERVICE", - "original": "You don't add this guard to the `MissionControlComponent` because, as the parent,\nit controls the lifetime of the `MissionService`.", - "translation": "不需要在 `MissionControlComponent` 中添加这个保护措施,因为它作为父组件,控制着 `MissionService` 的生命期。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "THEHISTORYLOGDEMONSTRATESTHATMESSAGESTRAVELINBOTHDIRECTIONSBETWEENTHEPARENTMISSIONCONTROLCOMPONENTANDTHEASTRONAUTCOMPONENTCHILDRENFACILITATEDBYTHESERVICE:", - "original": "The *History* log demonstrates that messages travel in both directions between\nthe parent `MissionControlComponent` and the `AstronautComponent` children,\nfacilitated by the service:", - "translation": "*History* 日志证明了:在父组件 `MissionControlComponent` 和子组件 `AstronautComponent` 之间,信息通过该服务实现了双向传递。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "H3CLASSNOTOCTESTITH3", - "original": "

    Test it

    ", - "translation": "

    测试一下!

    ", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "TESTSCLICKBUTTONSOFBOTHTHEPARENTMISSIONCONTROLCOMPONENTANDTHEASTRONAUTCOMPONENTCHILDRENANDVERIFYTHATTHEHISTORYMEETSEXPECTATIONS:", - "original": "Tests click buttons of both the parent `MissionControlComponent` and the `AstronautComponent` children\nand verify that the history meets expectations:", - "translation": "测试确保点击父组件 `MissionControlComponent` 和子组件 `AstronautComponent` 两个的组件的按钮时,*History* 日志和预期的一样。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "BACKTOTOPGUIDECOMPONENTINTERACTION#TOP", - "original": "[Back to top](guide/component-interaction#top)", - "translation": "[回到顶部](guide/component-interaction#top)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-interaction.md" - }, - { - "key": "#COMPONENTSTYLES", - "original": "# Component Styles", - "translation": "# 组件样式", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "ANGULARAPPLICATIONSARESTYLEDWITHSTANDARDCSSTHATMEANSYOUCANAPPLYEVERYTHINGYOUKNOWABOUTCSSSTYLESHEETSSELECTORSRULESANDMEDIAQUERIESDIRECTLYTOANGULARAPPLICATIONS", - "original": "Angular applications are styled with standard CSS. That means you can apply\neverything you know about CSS stylesheets, selectors, rules, and media queries\ndirectly to Angular applications.", - "translation": "Angular 应用使用标准的 CSS 来设置样式。这意味着你可以把关于 CSS\n的那些知识和技能直接用于 Angular 程序中,例如:样式表、选择器、规则以及媒体查询等。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "ADDITIONALLYANGULARCANBUNDLECOMPONENTSTYLESWITHCOMPONENTSENABLINGAMOREMODULARDESIGNTHANREGULARSTYLESHEETS", - "original": "Additionally, Angular can bundle *component styles*\nwith components, enabling a more modular design than regular stylesheets.", - "translation": "另外,Angular 还能把*组件样式*捆绑在组件上,以实现比标准样式表更加模块化的设计。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THISPAGEDESCRIBESHOWTOLOADANDAPPLYTHESECOMPONENTSTYLES", - "original": "This page describes how to load and apply these component styles.", - "translation": "本章将会讲解如何加载和使用这些*组件样式*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "YOUCANRUNTHELIVEEXAMPLELIVEEXAMPLEINSTACKBLITZANDDOWNLOADTHECODEFROMTHERE", - "original": "You can run the in Stackblitz and download the code from there.", - "translation": "你可以运行,在 Stackblitz 中试用并下载本页的代码。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "##USINGCOMPONENTSTYLES", - "original": "## Using component styles", - "translation": "## 使用组件样式", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "FOREVERYANGULARCOMPONENTYOUWRITEYOUMAYDEFINENOTONLYANHTMLTEMPLATEBUTALSOTHECSSSTYLESTHATGOWITHTHATTEMPLATESPECIFYINGANYSELECTORSRULESANDMEDIAQUERIESTHATYOUNEED", - "original": "For every Angular component you write, you may define not only an HTML template,\nbut also the CSS styles that go with that template,\nspecifying any selectors, rules, and media queries that you need.", - "translation": "对你编写的每个 Angular 组件来说,除了定义 HTML 模板之外,还要定义用于模板的 CSS 样式、\n指定任意的选择器、规则和媒体查询。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "ONEWAYTODOTHISISTOSETTHESTYLESPROPERTYINTHECOMPONENTMETADATATHESTYLESPROPERTYTAKESANARRAYOFSTRINGSTHATCONTAINCSSCODEUSUALLYYOUGIVEITONESTRINGASINTHEFOLLOWINGEXAMPLE:", - "original": "One way to do this is to set the `styles` property in the component metadata.\nThe `styles` property takes an array of strings that contain CSS code.\nUsually you give it one string, as in the following example:", - "translation": "实现方式之一,是在组件的元数据中设置 `styles` 属性。\n`styles` 属性可以接受一个包含 CSS 代码的字符串数组。\n通常你只给它一个字符串就行了,如同下例:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "##STYLESCOPE", - "original": "## Style scope", - "translation": "## 范围化的样式", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THESTYLESSPECIFIEDINCOMPONENTMETADATAAPPLYONLYWITHINTHETEMPLATEOFTHATCOMPONENT", - "original": "The styles specified in `@Component` metadata _apply only within the template of that component_.", - "translation": "在 `@Component` 的元数据中指定的样式只会对该组件的模板生效。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THEYARENOTINHERITEDBYANYCOMPONENTSNESTEDWITHINTHETEMPLATENORBYANYCONTENTPROJECTEDINTOTHECOMPONENT", - "original": "They are _not inherited_ by any components nested within the template nor by any content projected into the component.", - "translation": "它们既不会被模板中嵌入的组件继承,也不会被通过内容投影(如 ng-content)嵌进来的组件继承。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "INTHISEXAMPLETHEH1STYLEAPPLIESONLYTOTHEHEROAPPCOMPONENTNOTTOTHENESTEDHEROMAINCOMPONENTNORTOH1TAGSANYWHEREELSEINTHEAPPLICATION", - "original": "In this example, the `h1` style applies only to the `HeroAppComponent`,\nnot to the nested `HeroMainComponent` nor to `

    ` tags anywhere else in the application.", - "translation": "在这个例子中,`h1` 的样式只对 `HeroAppComponent` 生效,既不会作用于内嵌的 `HeroMainComponent` ,也不会作用于应用中其它任何地方的 `

    ` 标签。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THISSCOPINGRESTRICTIONISASTYLINGMODULARITYFEATURE", - "original": "This scoping restriction is a ***styling modularity feature***.", - "translation": "这种范围限制就是所谓的***样式模块化***特性", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "YOUCANUSETHECSSCLASSNAMESANDSELECTORSTHATMAKETHEMOSTSENSEINTHECONTEXTOFEACHCOMPONENT", - "original": "* You can use the CSS class names and selectors that make the most sense in the context of each component.", - "translation": "可以使用对每个组件最有意义的 CSS 类名和选择器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "CLASSNAMESANDSELECTORSARELOCALTOTHECOMPONENTANDDONTCOLLIDEWITHCLASSESANDSELECTORSUSEDELSEWHEREINTHEAPPLICATION", - "original": "* Class names and selectors are local to the component and don't collide with\n classes and selectors used elsewhere in the application.", - "translation": "类名和选择器是仅属于组件内部的,它不会和应用中其它地方的类名和选择器出现冲突。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "CHANGESTOSTYLESELSEWHEREINTHEAPPLICATIONDONTAFFECTTHECOMPONENTSSTYLES", - "original": "* Changes to styles elsewhere in the application don't affect the component's styles.", - "translation": "组件的样式*不会*因为别的地方修改了样式而被意外改变。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "YOUCANCOLOCATETHECSSCODEOFEACHCOMPONENTWITHTHETYPESCRIPTANDHTMLCODEOFTHECOMPONENTWHICHLEADSTOANEATANDTIDYPROJECTSTRUCTURE", - "original": "* You can co-locate the CSS code of each component with the TypeScript and HTML code of the component,\n which leads to a neat and tidy project structure.", - "translation": "你可以让每个组件的 CSS 代码和它的 TypeScript、HTML 代码放在一起,这将促成清爽整洁的项目结构。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "YOUCANCHANGEORREMOVECOMPONENTCSSCODEWITHOUTSEARCHINGTHROUGHTHEWHOLEAPPLICATIONTOFINDWHEREELSETHECODEISUSED", - "original": "* You can change or remove component CSS code without searching through the\n whole application to find where else the code is used.", - "translation": "将来你可以修改或移除组件的 CSS 代码,而不用遍历整个应用来看它有没有被别处用到,只要看看当前组件就可以了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "##SPECIALSELECTORS", - "original": "## Special selectors", - "translation": "## 特殊的选择器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "COMPONENTSTYLESHAVEAFEWSPECIALSELECTORSFROMTHEWORLDOFSHADOWDOMSTYLESCOPINGDESCRIBEDINTHECSSSCOPINGMODULELEVEL1HTTPS:WWWW3ORGTRCSSSCOPING1PAGEONTHEW3CHTTPS:WWWW3ORGSITETHEFOLLOWINGSECTIONSDESCRIBETHESESELECTORS", - "original": "Component styles have a few special *selectors* from the world of shadow DOM style scoping\n(described in the [CSS Scoping Module Level 1](https://www.w3.org/TR/css-scoping-1) page on the\n[W3C](https://www.w3.org) site).\nThe following sections describe these selectors.", - "translation": "组件样式中有一些从影子(Shadow) DOM 样式范围领域(记录在[W3C](https://www.w3.org)的[CSS Scoping Module Level 1](https://www.w3.org/TR/css-scoping-1)中) 引入的特殊*选择器*:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "###:HOST", - "original": "### :host", - "translation": "### :host 选择器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "USETHE:HOSTPSEUDOCLASSSELECTORTOTARGETSTYLESINTHEELEMENTTHATHOSTSTHECOMPONENTASOPPOSEDTOTARGETINGELEMENTSINSIDETHECOMPONENTSTEMPLATE", - "original": "Use the `:host` pseudo-class selector to target styles in the element that *hosts* the component (as opposed to\ntargeting elements *inside* the component's template).", - "translation": "使用 `:host` 伪类选择器,用来选择组件*宿主*元素中的元素(相对于组件模板*内部*的元素)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THE:HOSTSELECTORISTHEONLYWAYTOTARGETTHEHOSTELEMENTYOUCANTREACHTHEHOSTELEMENTFROMINSIDETHECOMPONENTWITHOTHERSELECTORSBECAUSEITSNOTPARTOFTHECOMPONENTSOWNTEMPLATETHEHOSTELEMENTISINAPARENTCOMPONENTSTEMPLATE", - "original": "The `:host` selector is the only way to target the host element. You can't reach\nthe host element from inside the component with other selectors because it's not part of the\ncomponent's own template. The host element is in a parent component's template.", - "translation": "`:host` 选择是是把宿主元素作为目标的*唯一*方式。除此之外,你将没办法指定它,\n因为宿主不是组件自身模板的一部分,而是父组件模板的一部分。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "USETHEFUNCTIONFORMTOAPPLYHOSTSTYLESCONDITIONALLYBYINCLUDINGANOTHERSELECTORINSIDEPARENTHESESAFTER:HOST", - "original": "Use the *function form* to apply host styles conditionally by\nincluding another selector inside parentheses after `:host`.", - "translation": "要把宿主样式作为条件,就要像*函数*一样把其它选择器放在 `:host` 后面的括号中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THENEXTEXAMPLETARGETSTHEHOSTELEMENTAGAINBUTONLYWHENITALSOHASTHEACTIVECSSCLASS", - "original": "The next example targets the host element again, but only when it also has the `active` CSS class.", - "translation": "下一个例子再次把宿主元素作为目标,但是只有当它同时带有 `active` CSS 类的时候才会生效。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "###:HOSTCONTEXT", - "original": "### :host-context", - "translation": "### :host-context 选择器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "SOMETIMESITSUSEFULTOAPPLYSTYLESBASEDONSOMECONDITIONOUTSIDEOFACOMPONENTSVIEWFOREXAMPLEACSSTHEMECLASSCOULDBEAPPLIEDTOTHEDOCUMENTBODYELEMENTANDYOUWANTTOCHANGEHOWYOURCOMPONENTLOOKSBASEDONTHAT", - "original": "Sometimes it's useful to apply styles based on some condition *outside* of a component's view.\nFor example, a CSS theme class could be applied to the document `` element, and\nyou want to change how your component looks based on that.", - "translation": "有时候,基于某些来自组件视图*外部*的条件应用样式是很有用的。\n例如,在文档的 `` 元素上可能有一个用于表示样式主题 (theme) 的 CSS 类,你应当基于它来决定组件的样式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "USETHE:HOSTCONTEXTPSEUDOCLASSSELECTORWHICHWORKSJUSTLIKETHEFUNCTIONFORMOF:HOSTTHE:HOSTCONTEXTSELECTORLOOKSFORACSSCLASSINANYANCESTOROFTHECOMPONENTHOSTELEMENTUPTOTHEDOCUMENTROOTTHE:HOSTCONTEXTSELECTORISUSEFULWHENCOMBINEDWITHANOTHERSELECTOR", - "original": "Use the `:host-context()` pseudo-class selector, which works just like the function\nform of `:host()`. The `:host-context()` selector looks for a CSS class in any ancestor of the component host element,\nup to the document root. The `:host-context()` selector is useful when combined with another selector.", - "translation": "这时可以使用 `:host-context()` 伪类选择器。它也以类似 `:host()` 形式使用。它在当前组件宿主元素的*祖先节点*中查找 CSS 类,\n直到文档的根节点为止。在与其它选择器组合使用时,它非常有用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THEFOLLOWINGEXAMPLEAPPLIESABACKGROUNDCOLORSTYLETOALLH2ELEMENTSINSIDETHECOMPONENTONLYIFSOMEANCESTORELEMENTHASTHECSSCLASSTHEMELIGHT", - "original": "The following example applies a `background-color` style to all `

    ` elements *inside* the component, only\nif some ancestor element has the CSS class `theme-light`.", - "translation": "在下面的例子中,只有当某个祖先元素有 CSS 类 `theme-light` 时,才会把 `background-color` 样式应用到组件*内部*的所有 `

    ` 元素中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "###DEPRECATEDDEEPAND::NGDEEP", - "original": "### (deprecated) `/deep/`, `>>>`, and `::ng-deep`", - "translation": "### 已废弃 `/deep/`、`>>>` 和 `::ng-deep`", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "COMPONENTSTYLESNORMALLYAPPLYONLYTOTHEHTMLINTHECOMPONENTSOWNTEMPLATE", - "original": "Component styles normally apply only to the HTML in the component's own template.", - "translation": "组件样式通常只会作用于组件自身的 HTML 上。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "USETHEDEEPSHADOWPIERCINGDESCENDANTCOMBINATORTOFORCEASTYLEDOWNTHROUGHTHECHILDCOMPONENTTREEINTOALLTHECHILDCOMPONENTVIEWSTHEDEEPCOMBINATORWORKSTOANYDEPTHOFNESTEDCOMPONENTSANDITAPPLIESTOBOTHTHEVIEWCHILDRENANDCONTENTCHILDRENOFTHECOMPONENT", - "original": "Use the `/deep/` shadow-piercing descendant combinator to force a style down through the child\ncomponent tree into all the child component views.\nThe `/deep/` combinator works to any depth of nested components, and it applies to both the view\nchildren and content children of the component.", - "translation": "可以使用 `/deep/` 选择器来强制一个样式对各级子组件的视图也生效,它*不但作用于组件的子视图,也会作用于组件的内容*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THEFOLLOWINGEXAMPLETARGETSALLH3ELEMENTSFROMTHEHOSTELEMENTDOWNTHROUGHTHISCOMPONENTTOALLOFITSCHILDELEMENTSINTHEDOM", - "original": "The following example targets all `

    ` elements, from the host element down\nthrough this component to all of its child elements in the DOM.", - "translation": "这个例子以所有的 `

    ` 元素为目标,从宿主元素到当前元素再到 DOM 中的所有子元素:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THEDEEPCOMBINATORALSOHASTHEALIASESAND::NGDEEP", - "original": "The `/deep/` combinator also has the aliases `>>>`, and `::ng-deep`.", - "translation": "`/deep/` 组合器还有两个别名:`>>>` 和 `::ng-deep`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "USEDEEPAND::NGDEEPONLYWITHEMULATEDVIEWENCAPSULATIONEMULATEDISTHEDEFAULTANDMOSTCOMMONLYUSEDVIEWENCAPSULATIONFORMOREINFORMATIONSEETHECONTROLLINGVIEWENCAPSULATIONGUIDECOMPONENTSTYLES#VIEWENCAPSULATIONSECTION", - "original": "Use `/deep/`, `>>>` and `::ng-deep` only with *emulated* view encapsulation.\nEmulated is the default and most commonly used view encapsulation. For more information, see the\n[Controlling view encapsulation](guide/component-styles#view-encapsulation) section.", - "translation": "`/deep/` 和 `>>>` 选择器只能被用在**仿真 (emulated) **模式下。\n这种方式是默认值,也是用得最多的方式。\n更多信息,见[控制视图封装模式](guide/component-styles#view-encapsulation)一节。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THESHADOWPIERCINGDESCENDANTCOMBINATORISDEPRECATEDANDSUPPORTISBEINGREMOVEDFROMMAJORBROWSERSHTTPS:WWWCHROMESTATUSCOMFEATURES6750456638341120ANDTOOLSASSUCHWEPLANTODROPSUPPORTINANGULARFORALL3OFDEEPAND::NGDEEPUNTILTHEN::NGDEEPSHOULDBEPREFERREDFORABROADERCOMPATIBILITYWITHTHETOOLS", - "original": "The shadow-piercing descendant combinator is deprecated and [support is being removed from major browsers](https://www.chromestatus.com/features/6750456638341120) and tools.\nAs such we plan to drop support in Angular (for all 3 of `/deep/`, `>>>` and `::ng-deep`).\nUntil then `::ng-deep` should be preferred for a broader compatibility with the tools.", - "translation": "CSS 标准中用于 \"刺穿 Shadow DOM\" 的组合器已经被废弃,并将[这个特性从主流浏览器和工具中移除](https://www.chromestatus.com/features/6750456638341120)。\n因此,我们也将在 Angular 中移除对它们的支持(包括 `/deep/`、`>>>` 和 `::ng-deep`)。\n目前,建议先统一使用 `::ng-deep`,以便兼容将来的工具。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "##LOADINGCOMPONENTSTYLES", - "original": "## Loading component styles", - "translation": "## 把样式加载进组件中", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THEREARESEVERALWAYSTOADDSTYLESTOACOMPONENT:", - "original": "There are several ways to add styles to a component:", - "translation": "有几种方式把样式加入组件:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "BYSETTINGSTYLESORSTYLEURLSMETADATA", - "original": "* By setting `styles` or `styleUrls` metadata.", - "translation": "设置 `styles` 或 `styleUrls` 元数据", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "INLINEINTHETEMPLATEHTML", - "original": "* Inline in the template HTML.", - "translation": "内联在模板的 HTML 中", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "WITHCSSIMPORTS", - "original": "* With CSS imports.", - "translation": "通过 CSS 文件导入", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THESCOPINGRULESOUTLINEDEARLIERAPPLYTOEACHOFTHESELOADINGPATTERNS", - "original": "The scoping rules outlined earlier apply to each of these loading patterns.", - "translation": "上述作用域规则对所有这些加载模式都适用。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "###STYLESINCOMPONENTMETADATA", - "original": "### Styles in component metadata", - "translation": "### 元数据中的样式", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "YOUCANADDASTYLESARRAYPROPERTYTOTHECOMPONENTDECORATOR", - "original": "You can add a `styles` array property to the `@Component` decorator.", - "translation": "你可以给 `@Component` 装饰器添加一个 `styles` 数组型属性。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "EACHSTRINGINTHEARRAYDEFINESSOMECSSFORTHISCOMPONENT", - "original": "Each string in the array defines some CSS for this component.", - "translation": "这个数组中的每一个字符串(通常也只有一个)定义一份 CSS。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "REMINDER:THESESTYLESAPPLYONLYTOTHISCOMPONENTTHEYARENOTINHERITEDBYANYCOMPONENTSNESTEDWITHINTHETEMPLATENORBYANYCONTENTPROJECTEDINTOTHECOMPONENT", - "original": "Reminder: these styles apply _only to this component_.\nThey are _not inherited_ by any components nested within the template nor by any content projected into the component.", - "translation": "注意:这些样式**只对当前组件生效**。\n它们**既不会作用于模板中嵌入的任何组件**,也不会作用于投影进来的组件(如 `ng-content` )。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THECLIDEFINESANEMPTYSTYLESARRAYWHENYOUCREATETHECOMPONENTWITHTHEINLINESTYLESFLAG", - "original": "The CLI defines an empty `styles` array when you create the component with the `--inline-styles` flag.", - "translation": "当使用 `--inline-styles` 标识创建组件时,CLI 就会定义一个空的 `styles` 数组", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "###STYLEFILESINCOMPONENTMETADATA", - "original": "### Style files in component metadata", - "translation": "### 组件元数据中的样式文件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "YOUCANLOADSTYLESFROMEXTERNALCSSFILESBYADDINGASTYLEURLSPROPERTYTOACOMPONENTSCOMPONENTDECORATOR:", - "original": "You can load styles from external CSS files by adding a `styleUrls` property\nto a component's `@Component` decorator:", - "translation": "你可以通过把外部 CSS 文件添加到 `@Component` 的 `styleUrls` 属性中来加载外部样式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "REMINDER:THESTYLESINTHESTYLEFILEAPPLYONLYTOTHISCOMPONENTTHEYARENOTINHERITEDBYANYCOMPONENTSNESTEDWITHINTHETEMPLATENORBYANYCONTENTPROJECTEDINTOTHECOMPONENT", - "original": "Reminder: the styles in the style file apply _only to this component_.\nThey are _not inherited_ by any components nested within the template nor by any content projected into the component.", - "translation": "注意:这些样式**只对当前组件生效**。\n它们**既不会作用于模板中嵌入的任何组件**,也不会作用于投影进来的组件(如 `ng-content` )。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "YOUCANSPECIFYMORETHANONESTYLESFILEOREVENACOMBINATIONOFSTYLEANDSTYLEURLS", - "original": "You can specify more than one styles file or even a combination of `style` and `styleUrls`.", - "translation": "你可以指定多个样式文件,甚至可以组合使用 `style` 和 `styleUrls` 方式。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "THECLICREATESANEMPTYSTYLESFILEFORYOUBYDEFAULTANDREFERENCESTHATFILEINTHECOMPONENTSGENERATEDSTYLEURLS", - "original": "The CLI creates an empty styles file for you by default and references that file in the component's generated `styleUrls`.", - "translation": "CLI 会默认为你创建一个空白的样式表文件,并且在所生成组件的 `styleUrls` 中引用该文件。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "###TEMPLATEINLINESTYLES", - "original": "### Template inline styles", - "translation": "### 模板内联样式", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" - }, - { - "key": "YOUCANEMBEDCSSSTYLESDIRECTLYINTOTHEHTMLTEMPLATEBYPUTTINGTHEMINSIDESTYLETAGS", - "original": "You can embed CSS styles directly into the HTML template by putting them\ninside `