diff --git a/aio/content/guide/router.md b/aio/content/guide/router.md index a459b6abdd..8e963973f9 100644 --- a/aio/content/guide/router.md +++ b/aio/content/guide/router.md @@ -3977,7 +3977,6 @@ Generate a new component to compose the message. It displays a simple form with a header, an input box for the message, and two buttons, "Send" and "Cancel". -在 `src/app/compose-message.component.ts` 中创建一个名叫 `ComposeMessageComponent` 的新组件。 它显示一个简单的表单,包括一个头、一个消息输入框和两个按钮:“Send”和“Cancel”。
@@ -4265,7 +4264,7 @@ A guard's return value controls the router's behavior: **Note:**The guard can also tell the router to navigate elsewhere, effectively canceling the current navigation. When doing so inside a guard, the guard should return `false`; -**注意**:守卫还可以告诉路由器导航到别处,这样也取消当前的导航。 +**注意**:守卫还可以告诉路由器导航到别处,这样也会取消当前的导航。要想在守卫中这么做,就要返回 `false`; diff --git a/aio/content/guide/security.md b/aio/content/guide/security.md index 445bcf33df..d8d74abf2a 100644 --- a/aio/content/guide/security.md +++ b/aio/content/guide/security.md @@ -392,9 +392,9 @@ For information about CSRF at the Open Web Application Security Project (OWASP), The Stanford University paper Robust Defenses for Cross-Site Request Forgery is a rich source of detail. -到开放式 Web 应用程序安全项目(OWASP)的[这里](https://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29) -和[这里](https://www.owasp.org/index.php/CSRF_Prevention_Cheat_Sheet)学习更多关于跨站请求伪造(XSRF)的知识。 -这个[斯坦福大学论文](https://seclab.stanford.edu/websec/csrf/csrf.pdf)有详尽的细节。 +可到 "开放式 Web 应用程序安全项目 (OWASP) " 深入了解 CSRF,参见[Cross-Site Request Forgery (CSRF)](https://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29) +和[Cross-Site Request Forgery (CSRF) Prevention Cheat Sheet](https://www.owasp.org/index.php/CSRF_Prevention_Cheat_Sheet)。 +这个斯坦福大学论文 [Robust Defenses for Cross-Site Request Forgery](https://seclab.stanford.edu/websec/csrf/csrf.pdf) 有详尽的细节。 See also Dave Smith's easy-to-understand talk on XSRF at AngularConnect 2016. diff --git a/aio/content/guide/service-worker-config.md b/aio/content/guide/service-worker-config.md index 4771396cd3..ed98739ba9 100644 --- a/aio/content/guide/service-worker-config.md +++ b/aio/content/guide/service-worker-config.md @@ -195,8 +195,7 @@ This section describes the resources to cache, broken up into three groups. * `versionedFiles` has been deprecated. As of v6 `versionedFiles` and `files` options have the same behavior. Use `files` instead. - `versionedFiles` 和 `files` 相似,但是它用来对工件进行构建,这些工件已经在文件名中包含了一个散列,用于让其缓存失效。 - 如果 Angular Service Worker 能假定这些文件在文件名不变时其内容也不会变,那它就可以从某些方面优化这种操作。 + `versionedFiles` 已经废弃,因为 v6 版本的 `versionedFiles` 和 `files` 选项具有相同的行为。请改用 `files`。 * `urls` includes both URLs and URL patterns that will be matched at runtime. These resources are not fetched directly and do not have content hashes, but they will be cached according to their HTTP headers. This is most useful for CDNs such as the Google Fonts service.
_(Negative glob patterns are not supported and `?` will be matched literally; i.e. it will not match any character other than `?`.)_ @@ -204,7 +203,7 @@ This section describes the resources to cache, broken up into three groups. `urls` 包括要在运行时进行匹配的 URL 和 URL 模式。 这些资源不是直接获取的,也没有内容散列,但它们会根据 HTTP 标头进行缓存。 这对于像 Google Fonts 服务这样的 CDN 非常有用。
- **(不支持 glob 的逆模式)** + **(不支持 glob 的逆模式,`?` 将会按字面匹配;也就是说它不会匹配除了 `?` 之外的任何字符。)** ## `dataGroups` diff --git a/aio/content/guide/singleton-services.md b/aio/content/guide/singleton-services.md index 79abf59ffb..86c725fe8c 100644 --- a/aio/content/guide/singleton-services.md +++ b/aio/content/guide/singleton-services.md @@ -1,6 +1,6 @@ # Singleton services -# 单例应用 +# 单例服务 #### Prerequisites: diff --git a/aio/content/guide/template-syntax.md b/aio/content/guide/template-syntax.md index 8b977fe27a..c2bfec4b46 100644 --- a/aio/content/guide/template-syntax.md +++ b/aio/content/guide/template-syntax.md @@ -298,7 +298,7 @@ Change detection cycles are triggered by many asynchronous activities such as promise resolutions, http results, timer events, keypresses and mouse moves. Angular 会在每个变更检测周期后执行模板表达式。 -它们可能在每一次按键或鼠标移动后被调用。 +变更检测周期会被多种异步活动触发,比如 Promise 解析、HTTP 结果、定时器时间、按键或鼠标移动。 Expressions should finish quickly or the user experience may drag, especially on slower devices. Consider caching values when their computation is expensive. diff --git a/aio/content/guide/testing.md b/aio/content/guide/testing.md index 50a26d786f..42692a5e3a 100644 --- a/aio/content/guide/testing.md +++ b/aio/content/guide/testing.md @@ -5448,6 +5448,7 @@ Here are the most useful `DebugElement` members for testers, in approximate orde See [above](#trigger-event-handler). 如果在该元素的 `listeners` 集合中有相应的监听器,就根据名字触发这个事件。 + 第二个参数是该处理器函数所需的*事件对象*。参见[前面](#trigger-event-handler)。 If the event lacks a listener or there's some other problem, consider calling `nativeElement.dispatchEvent(eventObject)`. diff --git a/aio/content/guide/universal.md b/aio/content/guide/universal.md index 9ecd2f59b7..d34486bdc2 100644 --- a/aio/content/guide/universal.md +++ b/aio/content/guide/universal.md @@ -641,6 +641,7 @@ Now let's create a few handy scripts to help us do all of this in the future. You can add these in the `"server"` section of the Angular configuration file, `angular.json`. 现在,来创建一些便利脚本,在以后帮助我们完成这些琐事。 +你可以在 Angular 配置文件 `angular.json` 的 `"server"` 区添加这些脚本。 "architect": { diff --git a/packages/animations/src/animation_metadata.ts b/packages/animations/src/animation_metadata.ts index 5f7841e3ae..b549bd426e 100755 --- a/packages/animations/src/animation_metadata.ts +++ b/packages/animations/src/animation_metadata.ts @@ -1679,6 +1679,7 @@ export function useAnimation( * An array is treated as an animation sequence. * * 要应用到所查询到的单个或一组元素上的一个或多个动画步骤。 + * 该数组会被视为一个动画序列。 * * @param options An options object. Use the 'limit' field to limit the total number of * items to collect. diff --git a/packages/common/src/directives/ng_switch.ts b/packages/common/src/directives/ng_switch.ts index a58f3f9c51..84b4429c4c 100644 --- a/packages/common/src/directives/ng_switch.ts +++ b/packages/common/src/directives/ng_switch.ts @@ -54,7 +54,7 @@ export class SwitchView { * * Adds / removes DOM sub-trees when the nest match expressions matches the switch expression. * - * 根据内嵌的 match(匹配)表达式(`match_express_*`)与 switch(多路开关)表达式(`switch_expression`)的匹配结果,添加 / 删除 DOM 子树。 + * 根据内嵌的匹配表达式和 switch 表达式的匹配结果,添加或删除子树。 * * `NgSwitch` stamps out nested views when their match expression value matches the value of the * switch expression. diff --git a/packages/common/src/pipes/number_pipe.ts b/packages/common/src/pipes/number_pipe.ts index 1199f6b6e8..34bff323fa 100644 --- a/packages/common/src/pipes/number_pipe.ts +++ b/packages/common/src/pipes/number_pipe.ts @@ -286,7 +286,9 @@ export class CurrencyPipe implements PipeTransform { * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies. * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none. * - * `maxFractionDigits`:小数点后的最大为数,默认为 `3`。如果没有提供, + * `maxFractionDigits`:小数点后的最大为数,默认为 `3`。 + * 如果没有提供,该数字就会根据 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 规范进行适当的格式化。 + * 比如,加拿大元具有 2 位数字,而智利比索则没有。 * * @param locale A locale code for the locale format rules to use. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. diff --git a/packages/core/src/metadata/directives.ts b/packages/core/src/metadata/directives.ts index 02c0808c66..1b60bdb894 100644 --- a/packages/core/src/metadata/directives.ts +++ b/packages/core/src/metadata/directives.ts @@ -107,7 +107,7 @@ export interface Directive { * The CSS selector that identifies this directive in a template * and triggers instantiation of the directive. * - * 这个 CSS 选择器用于触发指令的实例化。 + * 这个 CSS 选择器用于在模板中标记出该指令,并触发该指令的实例化。 * * Declare as one of the following: * @@ -434,6 +434,7 @@ export interface ComponentDecorator { * Unlike other directives, only one component can be instantiated per an element in a template. * * Angular 的组件是指令的一个子集,它总是有一个与之关联的模板。 + * 和其它指令不同,模板中的每个元素只能具有一个组件实例。 * * A component must belong to an NgModule in order for it to be available * to another component or application. To make it a member of an NgModule, diff --git a/packages/core/src/metadata/ng_module.ts b/packages/core/src/metadata/ng_module.ts index 61b366c3a4..ec97980f4a 100644 --- a/packages/core/src/metadata/ng_module.ts +++ b/packages/core/src/metadata/ng_module.ts @@ -354,6 +354,7 @@ export interface NgModule { * ModuleA can use UserComponent. * * 默认情况下,可声明对象是私有的。 + * 如果 ModuleA 不导出 UserComponent,那么只有这个 ModuleA 中的组件才能使用 UserComponent。 * * ModuleA can import ModuleB and also export it, making exports from ModuleB * available to an NgModule that imports ModuleA. diff --git a/packages/core/src/render/api.ts b/packages/core/src/render/api.ts index 7ae83e2dd7..3d2dd7dd2f 100644 --- a/packages/core/src/render/api.ts +++ b/packages/core/src/render/api.ts @@ -322,7 +322,7 @@ export abstract class Renderer2 { * * @param refChild The existing child node that should precede the new node. * - * 将位于新节点之前的现有节点。 + * 将会插入在这个新节点之前的现有节点。 */ abstract insertBefore(parent: any, newChild: any, refChild: any): void; /** diff --git a/packages/forms/src/directives/reactive_directives/form_control_name.ts b/packages/forms/src/directives/reactive_directives/form_control_name.ts index b0b52adce5..da346beb83 100644 --- a/packages/forms/src/directives/reactive_directives/form_control_name.ts +++ b/packages/forms/src/directives/reactive_directives/form_control_name.ts @@ -38,9 +38,6 @@ export const controlNameBinding: any = { * @see `FormControl` * @see `AbstractControl` * - * 该指令会确保通过程序写入到该 `FormControl` 实例的任何值都会被写入到 DOM 元素上(模型 -> 视图)。 - * 反过来,任何通过用户输入写入 DOM 元素上的值也会被反映到这个 `FormControl` 实例上(视图 -> 模型)。 - * * @usageNotes * * ### Register `FormControl` within a group diff --git a/packages/forms/src/validators.ts b/packages/forms/src/validators.ts index 62e6862c56..3319a3c146 100644 --- a/packages/forms/src/validators.ts +++ b/packages/forms/src/validators.ts @@ -331,13 +331,13 @@ export class Validators { * Validator that requires the control's value to match a regex pattern. This validator is also * provided by default if you use the HTML5 `pattern` attribute. * - * Note that if a Regexp is provided, the Regexp is used as is to test the values. On the other - * hand, if a string is passed, the `^` character is prepended and the `$` character is - * appended to the provided string (if not already present), and the resulting regular - * expression is used to test the values. - * * 此验证器要求控件的值匹配某个正则表达式。当使用 HTML5 的 `pattern` 属性时,它也会生效。 * + * Note that if a Regexp is provided, the Regexp is used as is to test the values. On the other hand, if a string is passed, the `^` character is prepended and the `$` character is appended to the provided string (if not already present), and the resulting regular expression is used to test the values. + * + * 注意,如果提供了 Regexp,则使用 Regexp 来测试值。另一方面,如果传给它一个字符串,则会自动添加 `^` 前缀和 `$` 后缀(如果没有), + * 并使用所生成的正则表达式来测试那些值。 + * * @usageNotes * * ### Validate that the field only contains letters or spaces