diff --git a/aio/content/cli/index.md b/aio/content/cli/index.md index 6083ef6775..e813a6d9f1 100644 --- a/aio/content/cli/index.md +++ b/aio/content/cli/index.md @@ -59,6 +59,7 @@ In your browser, open http://localhost:4200/ to see the new app run. When you use the [ng serve](cli/serve) command to build an app and serve it locally, the server automatically rebuilds the app and reloads the page when you change any of the source files. 在浏览器中,打开 查看运行效果。 +当你使用 [ng serve](cli/serve) 命令来构建应用并在本地启动开发服务器时,服务器会自动重新构建此应用,并在修改源码时重新加载此页面。 ## Workspaces and project files @@ -106,6 +107,7 @@ The [ng config](cli/config) command lets you set and retrieve configuration valu Note that option names in the configuration file must use [camelCase](guide/glossary#case-types), while option names supplied to commands can use either camelCase or dash-case. [ng config](cli/config) 让你可以从命令行中设置和获取配置项的值。你也可以直接编辑 `angular.json` 文件。 +注意,此配置文件中的选项名称必须使用[小驼峰(camelCase)形式](guide/glossary#case-types),不过当在命令行中提供它是可以使用小驼峰和中线分隔(dash-case)两种形式。 * See more about [Workspace Configuration](guide/workspace-config). diff --git a/aio/content/guide/aot-compiler.md b/aio/content/guide/aot-compiler.md index e8bef0dcd6..33152d2117 100644 --- a/aio/content/guide/aot-compiler.md +++ b/aio/content/guide/aot-compiler.md @@ -1339,18 +1339,18 @@ The following are metadata errors you may encounter, with explanations and sugge 你可能遇到一些元数据错误,下面是对它们的解释和纠正建议。 -[Expression form not supported【不支持此表达式格式】](#expression-form-not-supported)
-[Reference to a local (non-exported) symbol【引用了局部(未导出的)符号】](#reference-to-a-local-symbol)
-[Only initialized variables and constants【只允许初始化过的变量和常量】](#only-initialized-variables)
-[Reference to a non-exported class【引用了未导出的类】](#reference-to-a-non-exported-class)
-[Reference to a non-exported function【引用了未导出的函数】](#reference-to-a-non-exported-function)
-[Function calls are not supported【不支持函数调用】](#function-calls-not-supported)
-[Destructured variable or constant not supported【不支持解构变量或常量】](#destructured-variable-not-supported)
-[Could not resolve type【不能解析此类型】](#could-not-resolve-type)
-[Name expected【期待是名字】](#name-expected)
-[Unsupported enum member name【不支持的枚举成员名】](#unsupported-enum-member-name)
-[Tagged template expressions are not supported【不支持带标签函数的模板表达式】](#tagged-template-expressions-not-supported)
-[Symbol reference expected【期待是符号引用】](#symbol-reference-expected)
+[Expression form not supported不支持此表达式格式](#expression-form-not-supported)
+[Reference to a local (non-exported) symbol引用了局部(未导出的)符号](#reference-to-a-local-symbol)
+[Only initialized variables and constants只允许初始化过的变量和常量](#only-initialized-variables)
+[Reference to a non-exported class引用了未导出的类](#reference-to-a-non-exported-class)
+[Reference to a non-exported function引用了未导出的函数](#reference-to-a-non-exported-function)
+[Function calls are not supported不支持函数调用](#function-calls-not-supported)
+[Destructured variable or constant not supported不支持解构变量或常量](#destructured-variable-not-supported)
+[Could not resolve type不能解析此类型](#could-not-resolve-type)
+[Name expected期待是名字](#name-expected)
+[Unsupported enum member name不支持的枚举成员名](#unsupported-enum-member-name)
+[Tagged template expressions are not supported不支持带标签函数的模板表达式](#tagged-template-expressions-not-supported)
+[Symbol reference expected期待是符号引用](#symbol-reference-expected)

@@ -1935,6 +1935,7 @@ The compiler expected a name in an expression it was evaluating. This can happen if you use a number as a property name as in the following example. 编译器期待它正在求值的表达式中是一个名字。 +如果你像下面的例子中这样用一个数字作为属性名,就会导致这个问题。 ``` diff --git a/aio/content/guide/architecture-next-steps.md b/aio/content/guide/architecture-next-steps.md index 5450b720ca..dce24d2e5f 100644 --- a/aio/content/guide/architecture-next-steps.md +++ b/aio/content/guide/architecture-next-steps.md @@ -103,4 +103,4 @@ without deep knowledge of animation techniques or CSS. * [Deployment](guide/deployment): Learn techniques for deploying your Angular application to a remote server. - [发布](guide/deployment):学习把你的应用发布到远端服务器的技巧。 + [部署](guide/deployment):学习把你的应用发布到远端服务器的技巧。 diff --git a/aio/content/guide/attribute-directives.md b/aio/content/guide/attribute-directives.md index 78d9954754..bd449b132b 100644 --- a/aio/content/guide/attribute-directives.md +++ b/aio/content/guide/attribute-directives.md @@ -167,7 +167,7 @@ You use the `ElementRef` in the directive's constructor to [inject](guide/dependency-injection) a reference to the host DOM element, the element to which you applied `appHighlight`. -你可以在指令的构造函数中注入 `ElementRef`,来引用宿主 DOM 元素, +你可以在指令的构造函数中使用 `ElementRef` 来[注入](guide/dependency-injection)宿主 DOM 元素的引用,也就是你放置 `appHighlight` 的那个元素。 `ElementRef` grants direct access to the host DOM element through its `nativeElement` property. diff --git a/aio/content/guide/cheatsheet.md b/aio/content/guide/cheatsheet.md index f561db6900..55e8a32d1b 100644 --- a/aio/content/guide/cheatsheet.md +++ b/aio/content/guide/cheatsheet.md @@ -957,7 +957,7 @@ so the @Directive configuration applies to components as well

(implemented as class methods)

-

由类的方法实现。

+

(作为类的方法实现。)

diff --git a/aio/content/guide/component-styles.md b/aio/content/guide/component-styles.md index 682143e088..b0c459c339 100644 --- a/aio/content/guide/component-styles.md +++ b/aio/content/guide/component-styles.md @@ -107,8 +107,6 @@ The following sections describe these selectors. ### :host -### :host 选择器 - Use the `:host` pseudo-class selector to target styles in the element that *hosts* the component (as opposed to targeting elements *inside* the component's template). @@ -138,8 +136,6 @@ The next example targets the host element again, but only when it also has the ` ### :host-context -### :host-context 选择器 - Sometimes it's useful to apply styles based on some condition *outside* of a component's view. For example, a CSS theme class could be applied to the document `` element, and you want to change how your component looks based on that. @@ -307,7 +303,7 @@ They are _not inherited_ by any components nested within the template nor by any When you use the Angular CLI command [`ng generate component`](cli/generate) without the `--inline-style` flag, it creates an empty styles file for you and references that file in the component's generated `styleUrls`. -CLI 会默认为你创建一个空白的样式表文件,并且在所生成组件的 `styleUrls` 中引用该文件。 +当你使用 Angular CLI 的 [`ng generate component`](cli/generate) 命令但不带 `--inline-style` 标志时,CLI 会为你创建一个空白的样式表文件,并且在所生成组件的 `styleUrls` 中引用该文件。 ng generate component hero-app @@ -429,7 +425,7 @@ Style strings added to the `@Component.styles` array _must be written in CSS_ be ## View encapsulation -## 控制视图的封装模式:原生 (Native)、仿真 (Emulated) 和无 (None) +## 视图封装模式 As discussed earlier, component CSS styles are encapsulated into the component's view and don't affect the rest of the application. @@ -491,7 +487,7 @@ in most cases. ## Inspecting generated CSS -## 查看仿真 (Emulated) 模式下生成的 CSS +## 查看生成的 CSS When using emulated view encapsulation, Angular preprocesses all component styles so that they approximate the standard shadow CSS scoping rules. diff --git a/packages/router/src/interfaces.ts b/packages/router/src/interfaces.ts index 2e433bee63..7e0a94f7ee 100644 --- a/packages/router/src/interfaces.ts +++ b/packages/router/src/interfaces.ts @@ -23,6 +23,8 @@ import {UrlSegment, UrlTree} from './url_tree'; * guard. * * 一个接口,某些类可以实现它以扮演一个守卫,来决定该路由能否激活。 + * 如果所有守卫都返回 `true`,就会继续导航。如果任何一个守卫返回了 `false`,就会取消导航。 + * 如果任何一个守卫返回了 `UrlTree`,就会取消当前导航,并开始导航到这个守卫所返回的 `UrlTree`。 * * ``` * class UserToken {} @@ -104,6 +106,8 @@ export type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSn * guard. * * 一个接口,某些类可以实现它以扮演一个守卫,来决定该路由的子路由能否激活。 + * 如果所有守卫都返回 `true`,就会继续导航。如果任何一个守卫返回了 `false`,就会取消导航。 + * 如果任何一个守卫返回了 `UrlTree`,就会取消当前导航,并开始导航到这个守卫所返回的 `UrlTree`。 * * ``` * class UserToken {} @@ -195,6 +199,8 @@ export type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: Rou * guard. * * 一个接口,某些类可以实现它以扮演一个守卫,来决定该路由能否停用。 + * 如果所有守卫都返回 `true`,就会继续导航。如果任何一个守卫返回了 `false`,就会取消导航。 + * 如果任何一个守卫返回了 `UrlTree`,就会取消当前导航,并开始导航到这个守卫所返回的 `UrlTree`。 * * ``` * class UserToken {}