fix: 修订了一部分翻译错误
This commit is contained in:
parent
d5057aec3b
commit
8f4caa7cb1
@ -92,7 +92,7 @@ ng generate directive highlight
|
|||||||
|
|
||||||
The CLI creates `src/app/highlight.directive.ts`, a corresponding test file `src/app/highlight.directive.spec.ts`, and _declares_ the directive class in the root `AppModule`.
|
The CLI creates `src/app/highlight.directive.ts`, a corresponding test file `src/app/highlight.directive.spec.ts`, and _declares_ the directive class in the root `AppModule`.
|
||||||
|
|
||||||
CLI 会创建 `src/app/highlight.directive.ts` 及相应的测试文件(`.../spec.ts`),并且在根模块 `AppModule` 中声明这个指令类。
|
CLI 会创建 `src/app/highlight.directive.ts` 及相应的测试文件(`src/app/highlight.directive.spec.ts`),并且在根模块 `AppModule` 中声明这个指令类。
|
||||||
|
|
||||||
<div class="alert is-helpful">
|
<div class="alert is-helpful">
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ For example, to divert all calls for `http://localhost:4200/api` to a server run
|
|||||||
|
|
||||||
1. Create a file `proxy.conf.json` in the projects `src/` folder, in the same directory as `package.json`.
|
1. Create a file `proxy.conf.json` in the projects `src/` folder, in the same directory as `package.json`.
|
||||||
|
|
||||||
在项目的 `src/` 目录下创建一个 `proxy.conf.json` 文件,紧挨着 `package.json`。
|
在项目的 `src/` 目录下创建一个 `proxy.conf.json` 文件,和 `package.json` 放在同一目录下。
|
||||||
|
|
||||||
1. Add the following content to the new proxy file:
|
1. Add the following content to the new proxy file:
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ The public API for your library is maintained in the `public-api.ts` file in you
|
|||||||
Anything exported from this file is made public when your library is imported into an application.
|
Anything exported from this file is made public when your library is imported into an application.
|
||||||
Use an NgModule to expose services and components.
|
Use an NgModule to expose services and components.
|
||||||
|
|
||||||
库的公共 API 是在库文件夹下的 `index.ts` 文件中维护的。当你的库被导入应用时,从该文件导出的所有内容都会公开。请使用 NgModule 来暴露这些服务和组件。
|
库的公共 API 是在库文件夹下的 `public-api.ts` 文件中维护的。当你的库被导入应用时,从该文件导出的所有内容都会公开。请使用 NgModule 来暴露这些服务和组件。
|
||||||
|
|
||||||
Your library should supply documentation (typically a README file) for installation and maintenance.
|
Your library should supply documentation (typically a README file) for installation and maintenance.
|
||||||
|
|
||||||
@ -162,11 +162,11 @@ A library can include [schematics](guide/glossary#schematic) that allow it to in
|
|||||||
|
|
||||||
* Include an update schematic so that `ng update` can update your library’s dependencies and provide migrations for breaking changes in new releases.
|
* Include an update schematic so that `ng update` can update your library’s dependencies and provide migrations for breaking changes in new releases.
|
||||||
|
|
||||||
包含一个更新型 schematic ,以便 `ng update` 可以更新此库的依赖,并针对新版本中的破坏性变更提供辅助迁移。
|
包含一个更新(update)schematic ,以便 `ng update` 可以更新此库的依赖,并针对新版本中的破坏性变更提供辅助迁移。
|
||||||
|
|
||||||
To learn more, see [Schematics Overview](guide/schematics) and [Schematics for Libraries](guide/schematics-for-libraries).
|
To learn more, see [Schematics Overview](guide/schematics) and [Schematics for Libraries](guide/schematics-for-libraries).
|
||||||
|
|
||||||
要了解更多信息,参见 [Schematic - 简介](https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2) 。
|
要了解更多信息,参见 [原理图概览](guide/schematics) 和 [供库使用的原理图](guide/schematics-for-libraries)。
|
||||||
|
|
||||||
## Publishing your library
|
## Publishing your library
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ through the injector tree until it reaches the root injector.
|
|||||||
|
|
||||||
* If no provider is found in the root injector, the DI framework throws an error.
|
* If no provider is found in the root injector, the DI framework throws an error.
|
||||||
|
|
||||||
如果在根注入器中也没有找到提供商,则 DI 框架将会给构造函数返回一个 null。
|
如果在根注入器中也没有找到提供商,则 DI 框架将会抛出一个错误。
|
||||||
|
|
||||||
There are a number of options for modifying the default search behavior, using _parameter decorators_
|
There are a number of options for modifying the default search behavior, using _parameter decorators_
|
||||||
on the service-valued parameters of a class constructor.
|
on the service-valued parameters of a class constructor.
|
||||||
@ -880,9 +880,13 @@ The `MinimalLogger` transpiles to this unoptimized, pre-minified JavaScript for
|
|||||||
</code-example>
|
</code-example>
|
||||||
|
|
||||||
Notice that it doesn't have any members. It never grows no matter how many members you add to the class,
|
Notice that it doesn't have any members. It never grows no matter how many members you add to the class,
|
||||||
as long as those members are typed but not implemented.Look again at the TypeScript `MinimalLogger` class to confirm that it has no implementation.
|
as long as those members are typed but not implemented.
|
||||||
|
|
||||||
注意,***只要不实现它***,不管添加多少成员,它永远不会增长大小,因为这些成员虽然是有类型的,但却没有实现。你可以再看看 TypeScript 的 `MinimalLogger` 类,确定一下它是没有实现的。
|
注意,***只要不实现它***,不管添加多少成员,它都不会增长大小,因为这些成员虽然是有类型的,但却没有实现。
|
||||||
|
|
||||||
|
Look again at the TypeScript `MinimalLogger` class to confirm that it has no implementation.
|
||||||
|
|
||||||
|
你可以再看看 TypeScript 的 `MinimalLogger` 类,确定一下它是没有实现的。
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ You can then import this module into your application module
|
|||||||
to make the service available for injection in your app,
|
to make the service available for injection in your app,
|
||||||
as in the following example.
|
as in the following example.
|
||||||
|
|
||||||
该模块以后可以导入到你的应用模块中,以便该服务可注入到你的应用中,例子如下。
|
你可以把该模块导入到你的应用模块中,以便该服务可注入到你的应用中,例子如下。
|
||||||
|
|
||||||
<code-example path="dependency-injection/src/app/tree-shaking/app.module.ts" header="src/app/tree-shaking/app.modules.ts" linenums="false"> </code-example>
|
<code-example path="dependency-injection/src/app/tree-shaking/app.module.ts" header="src/app/tree-shaking/app.modules.ts" linenums="false"> </code-example>
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ you can still inject application-wide services into these components.
|
|||||||
A component's injector is a child of its parent component's injector, and inherits from all ancestor injectors all the way back to the application's _root_ injector. Angular can inject a service provided by any injector in that lineage.
|
A component's injector is a child of its parent component's injector, and inherits from all ancestor injectors all the way back to the application's _root_ injector. Angular can inject a service provided by any injector in that lineage.
|
||||||
|
|
||||||
借助[注入器继承机制](guide/hierarchical-dependency-injection),你仍然可以把全应用级的服务注入到这些组件中。
|
借助[注入器继承机制](guide/hierarchical-dependency-injection),你仍然可以把全应用级的服务注入到这些组件中。
|
||||||
组件的注入器是其父组件注入器的子节点,也是其父节点的父节点的后代,以此类推,直到应用的*根*注入器为止。
|
组件的注入器是其父组件注入器的子节点,它会继承所有的祖先注入器,其终点则是应用的*根*注入器。
|
||||||
Angular 可以注入该继承谱系中任何一个注入器提供的服务。
|
Angular 可以注入该继承谱系中任何一个注入器提供的服务。
|
||||||
|
|
||||||
For example, Angular can inject `HeroListComponent` with both the `HeroService` provided in `HeroComponent` and the `UserService` provided in `AppModule`.
|
For example, Angular can inject `HeroListComponent` with both the `HeroService` provided in `HeroComponent` and the `UserService` provided in `AppModule`.
|
||||||
|
@ -567,8 +567,6 @@ The Angular CLI uses two configurations for differential loading:
|
|||||||
- Browserslist - The `browserslist` configuration file is included in your application [project structure](guide/file-structure#application-configuration-files) and provides the minimum browsers your application supports. See the [Browserslist spec](https://github.com/browserslist/browserslist) for complete configuration options.
|
- Browserslist - The `browserslist` configuration file is included in your application [project structure](guide/file-structure#application-configuration-files) and provides the minimum browsers your application supports. See the [Browserslist spec](https://github.com/browserslist/browserslist) for complete configuration options.
|
||||||
- tsconfig.json - The `target` in the TypeScript `compilerOptions` determines the ECMAScript target version that the code is compiled to. Modern browsers support ES2015 natively, while ES5 is more commonly used to support legacy browsers.
|
- tsconfig.json - The `target` in the TypeScript `compilerOptions` determines the ECMAScript target version that the code is compiled to. Modern browsers support ES2015 natively, while ES5 is more commonly used to support legacy browsers.
|
||||||
|
|
||||||
在构建之前,`ng build` 和 `ng serve` 都会清空输出目录,但是只有 `ng build` 命令才会把生成的构建成果写入到输出目录下。
|
|
||||||
|
|
||||||
<div class="alert is-helpful">
|
<div class="alert is-helpful">
|
||||||
|
|
||||||
**Note:** Differential loading is currently only supported when using `es2015` as a compilation `target`. When used with targets higher than `es2015`, a warning is emitted during build time.
|
**Note:** Differential loading is currently only supported when using `es2015` as a compilation `target`. When used with targets higher than `es2015`, a warning is emitted during build time.
|
||||||
@ -628,10 +626,6 @@ not IE 9-11 # For IE 9-11 support, remove 'not'.
|
|||||||
|
|
||||||
The `tsconfig.json` looks like this:
|
The `tsconfig.json` looks like this:
|
||||||
|
|
||||||
|
|
||||||
`ng serve` 命令会构建、监视并使用本地开发服务器从内存中提供网站服务。
|
|
||||||
但是,当你将应用部署到其它服务器时,你可能希望仍然能持续看到你对该应用所做的修改。这时候,你可以为 `ng build` 命令添加 `--watch` 选项来做到这一点。
|
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user