translation - lifecycle hooks.

This commit is contained in:
Rex 2016-04-14 14:47:29 +01:00
parent 674d9eece8
commit c6c981887f
1 changed files with 43 additions and 5 deletions

View File

@ -474,17 +474,26 @@ include _util-fns
:marked :marked
The [official JavaScript language specification](https://en.wikipedia.org/wiki/ECMAScript). The [official JavaScript language specification](https://en.wikipedia.org/wiki/ECMAScript).
[官方Javascript语言规范](https://en.wikipedia.org/wiki/ECMAScript)
The latest approved version of JavaScript is The latest approved version of JavaScript is
[ECMAScript 2015](http://www.ecma-international.org/ecma-262/6.0/) [ECMAScript 2015](http://www.ecma-international.org/ecma-262/6.0/)
(AKA "ES2015" or "ES6") and many Angular 2 developers will write their applications (AKA "ES2015" or "ES6") and many Angular 2 developers will write their applications
either in this version of the language or a dialect that strives to be either in this version of the language or a dialect that strives to be
compatible with it such as [TypeScript](#typesScript). compatible with it such as [TypeScript](#typesScript).
最新的被认可的Javascript版本是[ECMAScript 2015](http://www.ecma-international.org/ecma-262/6.0/)也交“ES2015”或“ES6”。Angular 2的开发者要么这个版本的Javascript要么使用与这个版本兼容的语言比如[TypeScript](#typesScript)。
Most modern browsers today only support the prior "ECMAScript 5" (AKA ES5) standard. Most modern browsers today only support the prior "ECMAScript 5" (AKA ES5) standard.
Applications written in ES2015 or one of its dialects must be "[transpiled](#transpile)" Applications written in ES2015 or one of its dialects must be "[transpiled](#transpile)"
to ES5 JavaScript. to ES5 JavaScript.
目前几乎所有现代游览器都只支持上一版本“ECMAScript 5” 也就是ES5标准。使用ES2015或者其他兼容语言开发的应用程序都必须被编译“[transpiled](#transpile)”成ES5 Javascript。
Angular 2 developers may choose to write in ES5 directly. Angular 2 developers may choose to write in ES5 directly.
Angular 2的开发者也可以选择直接使用ES5编程。
:marked :marked
## ECMAScript 2015 ## ECMAScript 2015
.l-sub-section .l-sub-section
@ -492,22 +501,31 @@ include _util-fns
The lastest released version of JavaScript, The lastest released version of JavaScript,
[ECMAScript 2015](http://www.ecma-international.org/ecma-262/6.0/) [ECMAScript 2015](http://www.ecma-international.org/ecma-262/6.0/)
(AKA "ES2015" or "ES6") (AKA "ES2015" or "ES6")
最新发布的Javascript版本[ECMAScript 2015](http://www.ecma-international.org/ecma-262/6.0/)
(即 "ES2015" 或 "ES6")
:marked :marked
## ES2015 ## ES2015
.l-sub-section .l-sub-section
:marked :marked
Short hand for "[ECMAScript 2015](#ecmascript=2015)". Short hand for "[ECMAScript 2015](#ecmascript=2015)".
“[ECMAScript 2015](#ecmascript=2015)”的简写。
:marked :marked
## ES6 ## ES6
.l-sub-section .l-sub-section
:marked :marked
Short hand for "[ECMAScript 2015](#ecmascript=2015)". Short hand for "[ECMAScript 2015](#ecmascript=2015)".
[ECMAScript 2015](#ecmascript=2015)的简写。
:marked :marked
## ES5 ## ES5
.l-sub-section .l-sub-section
:marked :marked
Short hand for "ECMAScript 5", the version of JavaScript run by most modern browsers. Short hand for "ECMAScript 5", the version of JavaScript run by most modern browsers.
See [ECMAScript](#ecmascript). See [ECMAScript](#ecmascript).
“ECMAScript 5”的简写大部分现代浏览器使用的Javascript版本。请看[ECMAScript](#ecmascript)。
// #enddocregion e2 // #enddocregion e2
// #docregion f-l // #docregion f-l
@ -518,12 +536,14 @@ include _util-fns
.l-main-section .l-main-section
:marked :marked
## Injector ## Injector
## 注入器
.l-sub-section .l-sub-section
:marked :marked
An object in the Angular [dependency injection system](#dependency-injection) An object in the Angular [dependency injection system](#dependency-injection)
that can find a named "dependency" in its cache or create such a thing that can find a named "dependency" in its cache or create such a thing
with a registered [provider](#provider). with a registered [provider](#provider).
一个Angular[依赖注入系统](#dependency-injection)内部的对象,它可以在自己的内部缓存找到已点名的依赖或者利用一个注册过的[提供者provider](#provider)新建一个依赖。
:marked :marked
## Input ## Input
.l-sub-section .l-sub-section
@ -533,10 +553,15 @@ include _util-fns
Data values flow *into* this property from the data source identified Data values flow *into* this property from the data source identified
in the template expression to the right of the equal sign. in the template expression to the right of the equal sign.
一个指令属性:是[属性绑定Property Binding](guide/template-syntax.html#property-binding)的目标。数据值从处于模板表达式等号右边的数据源中,流入这个指令属性。
See the [Template Syntax](guide/template-syntax.html#inputs-outputs) chapter. See the [Template Syntax](guide/template-syntax.html#inputs-outputs) chapter.
请看[模板语法Template Syntax](guide/template-syntax.html#inputs-outputs)章节。
:marked :marked
## Interpolation ## Interpolation
## 插值表达式
.l-sub-section .l-sub-section
:marked :marked
A form of [Property Data Binding](#data-binding) in which a A form of [Property Data Binding](#data-binding) in which a
@ -545,6 +570,8 @@ include _util-fns
before it is assigned to an element property before it is assigned to an element property
or displayed between element tags as in this example. or displayed between element tags as in this example.
一种[属性数据绑定Property Data Binding](#data-binding) 的方式:在双大括号中间的[模板表达式](#template-expression)被渲染成文本。在被指派给元素属性或者在元素标记中间显示之前,这些文本可能与傍边的文本先合并,请看下面的例子。
code-example(language="html" escape="html"). code-example(language="html" escape="html").
<label>My current hero is {{hero.name}}</label> <label>My current hero is {{hero.name}}</label>
@ -552,6 +579,7 @@ include _util-fns
Learn more about interpolation in the Learn more about interpolation in the
[Template Syntax](guide/template-syntax.html#interpolation) chapter. [Template Syntax](guide/template-syntax.html#interpolation) chapter.
从[模板语法Template Syntax](guide/template-syntax.html#interpolation)章节学习更多关于插值表达式的知识。
<a id="J"></a> <a id="J"></a>
@ -559,23 +587,33 @@ include _util-fns
<a id="K"></a> <a id="K"></a>
:marked :marked
## kebab-case ## kebab-case
## 可芭比命名法
.l-sub-section .l-sub-section
:marked :marked
The practice of writing compound words or phrases such that each word is separated by a dash or hyphen (-). The practice of writing compound words or phrases such that each word is separated by a dash or hyphen (-).
使用横杠来分割每个单词的编写复合词或短语的命名方法。
Directive selectors and the root of filenames are often spelled in kebab-case. Examples include: `my-app` and the `hero-list.component.ts`. Directive selectors and the root of filenames are often spelled in kebab-case. Examples include: `my-app` and the `hero-list.component.ts`.
指令选择器和文件名字等一般都用可芭比命名法Kebab-case。比如`my-app`和`hero-list.component.ts`。
This form is also known as [dash-case](#dash-case). This form is also known as [dash-case](#dash-case).
这种命名法也被叫做[横杠命名法dash-case](#dash-case)
<a id="L"></a> <a id="L"></a>
.l-main-section .l-main-section
:marked :marked
## Lifecycle Hooks ## Lifecycle Hooks
## 生命周期钩子
.l-sub-section .l-sub-section
:marked :marked
[Directives](#directive) and [Components](#component) have a lifecycle [Directives](#directive) and [Components](#component) have a lifecycle
managed by Angular as it creates, updates and destroys them. managed by Angular as it creates, updates and destroys them.
[指令Directives](#directive)和[组件Components](#component)有生命周期由Angular在新建、更新和销毁的过程中管理。
Developers can tap into key moments in that lifecycle by implementing Developers can tap into key moments in that lifecycle by implementing
one or more of the "Lifecycle Hook" interfaces. one or more of the "Lifecycle Hook" interfaces.