fix: merge the cli-quickstart from history
This commit is contained in:
		
							parent
							
								
									8f950c26f2
								
							
						
					
					
						commit
						9f7ff05165
					
				| @ -1,20 +1,30 @@ | |||||||
| # QuickStart | # QuickStart | ||||||
| 
 | 
 | ||||||
|  | # 快速起步 | ||||||
|  | 
 | ||||||
| Good tools make application development quicker and easier to maintain than | Good tools make application development quicker and easier to maintain than | ||||||
| if you did everything by hand. | if you did everything by hand. | ||||||
| 
 | 
 | ||||||
|  | 好的工具能让开发更加简单快捷。 | ||||||
|  | 
 | ||||||
| The [**Angular CLI**](https://cli.angular.io/) is a **_command line interface_** tool | The [**Angular CLI**](https://cli.angular.io/) is a **_command line interface_** tool | ||||||
| that can create a project, add files, and perform a variety of ongoing development tasks such | that can create a project, add files, and perform a variety of ongoing development tasks such | ||||||
| as testing, bundling, and deployment. | as testing, bundling, and deployment. | ||||||
| 
 | 
 | ||||||
|  | [**Angular CLI**](https://cli.angular.io/)是一个**命令行界面**工具,它可以创建项目、添加文件以及执行一大堆开发任务,比如测试、打包和发布。 | ||||||
|  | 
 | ||||||
| The goal in this guide is to build and run a simple Angular | The goal in this guide is to build and run a simple Angular | ||||||
| application in TypeScript, using the Angular CLI | application in TypeScript, using the Angular CLI | ||||||
| while adhering to the [Style Guide](guide/styleguide) recommendations that | while adhering to the [Style Guide](guide/styleguide) recommendations that | ||||||
| benefit _every_ Angular project. | benefit _every_ Angular project. | ||||||
| 
 | 
 | ||||||
|  | 在这一章CLI快速起步中,我们的目标是构建并运行一个超级简单的Angular应用。我们会使用Angular-CLI来让每个Angular应用从[风格指南](guide/style-guide)中获益。 | ||||||
|  | 
 | ||||||
| By the end of the chapter, you'll have a basic understanding of development with the CLI | By the end of the chapter, you'll have a basic understanding of development with the CLI | ||||||
| and a foundation for both these documentation samples and for real world applications. | and a foundation for both these documentation samples and for real world applications. | ||||||
| 
 | 
 | ||||||
|  | 在本章的末尾,我们会通过CLI对开发过程有一个最基本的理解,并将其作为其它文档范例以及真实应用的基础。 | ||||||
|  | 
 | ||||||
| <!-- | <!-- | ||||||
| 
 | 
 | ||||||
| You'll pursue these ends in the following high-level steps: | You'll pursue these ends in the following high-level steps: | ||||||
| @ -28,6 +38,8 @@ You'll pursue these ends in the following high-level steps: | |||||||
| 
 | 
 | ||||||
| And you can also <a href="generated/zips/cli-quickstart/cli-quickstart.zip" target="_blank">download the example.</a> | And you can also <a href="generated/zips/cli-quickstart/cli-quickstart.zip" target="_blank">download the example.</a> | ||||||
| 
 | 
 | ||||||
|  | 你还可以 <a href="generated/zips/cli-quickstart/cli-quickstart.zip" target="_blank">下载这个例子</a> 。 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| <h2 id='devenv'> | <h2 id='devenv'> | ||||||
| @ -36,11 +48,22 @@ And you can also <a href="generated/zips/cli-quickstart/cli-quickstart.zip" targ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | <h2 id='devenv'> | ||||||
|  |   步骤1. 设置开发环境 | ||||||
|  | </h2> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| You need to set up your development environment before you can do anything. | You need to set up your development environment before you can do anything. | ||||||
| 
 | 
 | ||||||
|  | 在开始工作之前,我们必须设置好开发环境。 | ||||||
|  |   | ||||||
| Install **[Node.js® and npm](https://nodejs.org/en/download/)** | Install **[Node.js® and npm](https://nodejs.org/en/download/)** | ||||||
| if they are not already on your machine. | if they are not already on your machine. | ||||||
| 
 | 
 | ||||||
|  | 如果你的机器上还没有**[Node.js®和npm](https://nodejs.org/en/download/)**,请先安装它们。 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| <div class="l-sub-section"> | <div class="l-sub-section"> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -49,12 +72,19 @@ if they are not already on your machine. | |||||||
| by running `node -v` and `npm -v` in a terminal/console window. | by running `node -v` and `npm -v` in a terminal/console window. | ||||||
| Older versions produce errors, but newer versions are fine. | Older versions produce errors, but newer versions are fine. | ||||||
| 
 | 
 | ||||||
|  | 请先在终端/控制台窗口中运行命令 `node -v` 和 `npm -v`, | ||||||
|  | **来验证一下你正在运行 node `6.9.x` 和 npm `3.x.x` 以上的版本。** | ||||||
|  | 更老的版本可能会出现错误,更新的版本则没问题。 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| Then **install the [Angular CLI](https://github.com/angular/angular-cli)** globally. | Then **install the [Angular CLI](https://github.com/angular/angular-cli)** globally. | ||||||
| 
 | 
 | ||||||
|  | 然后全局安装 **[Angular CLI](https://github.com/angular/angular-cli)** 。 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| <code-example language="sh" class="code-shell"> | <code-example language="sh" class="code-shell"> | ||||||
|   npm install -g @angular/cli |   npm install -g @angular/cli | ||||||
| @ -70,11 +100,21 @@ Then **install the [Angular CLI](https://github.com/angular/angular-cli)** globa | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | <h2 id='create-proj'> | ||||||
|  |   步骤2. 创建新项目 | ||||||
|  | </h2> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| Open a terminal window. | Open a terminal window. | ||||||
| 
 | 
 | ||||||
|  | 打开终端窗口。 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| Generate a new project and skeleton application by running the following commands: | Generate a new project and skeleton application by running the following commands: | ||||||
| 
 | 
 | ||||||
|  | 运行下列命令来生成一个新项目以及应用的骨架代码: | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| <code-example language="sh" class="code-shell"> | <code-example language="sh" class="code-shell"> | ||||||
|   ng new my-app |   ng new my-app | ||||||
| @ -90,6 +130,9 @@ Generate a new project and skeleton application by running the following command | |||||||
| Patience please. | Patience please. | ||||||
| It takes time to set up a new project, most of it spent installing npm packages. | It takes time to set up a new project, most of it spent installing npm packages. | ||||||
| 
 | 
 | ||||||
|  | 请耐心等待。 | ||||||
|  | 创建新项目需要花费很多时间,大多数时候都是在安装那些npm包。 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
| @ -97,13 +140,23 @@ It takes time to set up a new project, most of it spent installing npm packages. | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| <h2 id='serve'> | <h2 id='serve'> | ||||||
|  |   | ||||||
|  |   <p> | ||||||
|   Step 3: Serve the application |   Step 3: Serve the application | ||||||
|  |   </p> | ||||||
|  | 
 | ||||||
|  |   <p> | ||||||
|  |     步骤3. 启动开发服务器 | ||||||
|  |   </p> | ||||||
|  | 
 | ||||||
| </h2> | </h2> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| Go to the project directory and launch the server. | Go to the project directory and launch the server. | ||||||
| 
 | 
 | ||||||
|  | 进入项目目录,并启动服务器。 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| <code-example language="sh" class="code-shell"> | <code-example language="sh" class="code-shell"> | ||||||
|   cd my-app |   cd my-app | ||||||
| @ -116,11 +169,16 @@ Go to the project directory and launch the server. | |||||||
| The `ng serve` command launches the server, watches your files, | The `ng serve` command launches the server, watches your files, | ||||||
| and rebuilds the app as you make changes to those files. | and rebuilds the app as you make changes to those files. | ||||||
| 
 | 
 | ||||||
|  | `ng serve`命令会启动开发服务器,监听文件变化,并在修改这些文件时重新构建此应用。 | ||||||
|  | 
 | ||||||
| Using the `--open` (or just `-o`) option will automatically open your browser | Using the `--open` (or just `-o`) option will automatically open your browser | ||||||
| on `http://localhost:4200/`. | on `http://localhost:4200/`. | ||||||
| 
 | 
 | ||||||
|  | 使用`--open`(或`-o`)参数可以自动打开浏览器并访问`http://localhost:4200/`。 | ||||||
|  | 
 | ||||||
| Your app greets you with a message: | Your app greets you with a message: | ||||||
| 
 | 
 | ||||||
|  | 本应用会用一条消息来跟你打招呼: | ||||||
| 
 | 
 | ||||||
| <figure> | <figure> | ||||||
|   <img src='generated/images/guide/cli-quickstart/app-works.png' alt="The app works!"> |   <img src='generated/images/guide/cli-quickstart/app-works.png' alt="The app works!"> | ||||||
| @ -135,13 +193,23 @@ Your app greets you with a message: | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | <h2 id='first-component'> | ||||||
|  |   步骤4. 编辑我们的第一个Angular组件 | ||||||
|  | </h2> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| The CLI created the first Angular component for you. | The CLI created the first Angular component for you. | ||||||
| This is the _root component_ and it is named `app-root`. | This is the _root component_ and it is named `app-root`. | ||||||
| You can find it in `./src/app/app.component.ts`. | You can find it in `./src/app/app.component.ts`. | ||||||
| 
 | 
 | ||||||
|  | 这个CLI为我们创建了第一个Angular组件。 | ||||||
|  | 它就是名叫`app-root`的*根组件*。 | ||||||
|  | 你可以在`./src/app/app.component.ts`目录下找到它。 | ||||||
| 
 | 
 | ||||||
| Open the component file and change the `title` property from _Welcome to app!!_ to _Welcome to My First Angular App!!_: | Open the component file and change the `title` property from _Welcome to app!!_ to _Welcome to My First Angular App!!_: | ||||||
| 
 | 
 | ||||||
|  | 打开这个组件文件,并且把`title`属性从 _Welcome to app!!_ 改为 _Welcome to My First Angular App!!_ : | ||||||
| 
 | 
 | ||||||
| <code-example path="cli-quickstart/src/app/app.component.ts" region="title" title="src/app/app.component.ts" linenums="false"></code-example> | <code-example path="cli-quickstart/src/app/app.component.ts" region="title" title="src/app/app.component.ts" linenums="false"></code-example> | ||||||
| 
 | 
 | ||||||
| @ -149,8 +217,11 @@ Open the component file and change the `title` property from _Welcome to app!!_ | |||||||
| 
 | 
 | ||||||
| The browser reloads automatically with the revised title. That's nice, but it could look better. | The browser reloads automatically with the revised title. That's nice, but it could look better. | ||||||
| 
 | 
 | ||||||
|  | 浏览器会自动刷新,而我们会看到修改之后的标题。不错,不过它还可以更好看一点。 | ||||||
|  | 
 | ||||||
| Open `src/app/app.component.css` and give the component some style. | Open `src/app/app.component.css` and give the component some style. | ||||||
| 
 | 
 | ||||||
|  | 打开 `src/app/app.component.css` 并给这个组件设置一些样式 | ||||||
| 
 | 
 | ||||||
| <code-example path="cli-quickstart/src/app/app.component.css" title="src/app/app.component.css" linenums="false"></code-example> | <code-example path="cli-quickstart/src/app/app.component.css" title="src/app/app.component.css" linenums="false"></code-example> | ||||||
| 
 | 
 | ||||||
| @ -164,37 +235,66 @@ Open `src/app/app.component.css` and give the component some style. | |||||||
| 
 | 
 | ||||||
| Looking good! | Looking good! | ||||||
| 
 | 
 | ||||||
|  | 漂亮! | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| ## What's next? | ## What's next? | ||||||
|  | 
 | ||||||
|  | ## 接下来呢? | ||||||
|  | 
 | ||||||
| That's about all you'd expect to do in a "Hello, World" app. | That's about all you'd expect to do in a "Hello, World" app. | ||||||
| 
 | 
 | ||||||
|  | 如你所愿,我们完成了这个“Hello, World”应用。 | ||||||
|  | 
 | ||||||
| You're ready to take the [Tour of Heroes Tutorial](tutorial) and build | You're ready to take the [Tour of Heroes Tutorial](tutorial) and build | ||||||
| a small application that demonstrates the great things you can build with Angular. | a small application that demonstrates the great things you can build with Angular. | ||||||
| 
 | 
 | ||||||
|  | 现在,你可以开始[英雄指南](tutorial)教程,通过构建一个小型应用来学习如何用Angular构建各种大型应用了。 | ||||||
|  | 
 | ||||||
| Or you can stick around a bit longer to learn about the files in your brand new project. | Or you can stick around a bit longer to learn about the files in your brand new project. | ||||||
| 
 | 
 | ||||||
|  | 或者,你也可以稍等一会儿,学学在这个新项目中的文件都是干什么用的。 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| ## Project file review | ## Project file review | ||||||
| 
 | 
 | ||||||
|  | ## 项目文件概览 | ||||||
|  | 
 | ||||||
| An Angular CLI project is the foundation for both quick experiments and enterprise solutions. | An Angular CLI project is the foundation for both quick experiments and enterprise solutions. | ||||||
| 
 | 
 | ||||||
|  | Angular CLI项目是做快速试验和开发企业解决方案的基础。 | ||||||
|  | 
 | ||||||
| The first file you should check out is `README.md`. | The first file you should check out is `README.md`. | ||||||
| It has some basic information on how to use CLI commands. | It has some basic information on how to use CLI commands. | ||||||
| Whenever you want to know more about how Angular CLI works make sure to visit | Whenever you want to know more about how Angular CLI works make sure to visit | ||||||
| [the Angular CLI repository](https://github.com/angular/angular-cli) and | [the Angular CLI repository](https://github.com/angular/angular-cli) and | ||||||
| [Wiki](https://github.com/angular/angular-cli/wiki). | [Wiki](https://github.com/angular/angular-cli/wiki). | ||||||
| 
 | 
 | ||||||
|  | 你首先要看的文件是`README.md`。 | ||||||
|  | 它提供了一些如何使用CLI命令的基础信息。 | ||||||
|  | 如果你想了解 Angular CLI 的工作原理,请访问 [Angular CLI 的仓库](https://github.com/angular/angular-cli)及其  | ||||||
|  |   [Wiki](https://github.com/angular/angular-cli/wiki)。 | ||||||
|  | 
 | ||||||
| Some of the generated files might be unfamiliar to you. | Some of the generated files might be unfamiliar to you. | ||||||
| 
 | 
 | ||||||
|  | 有些生成的文件你可能觉得陌生。接下来我们就讲讲它们。 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| ### The `src` folder | ### The `src` folder | ||||||
|  | 
 | ||||||
|  | ### `src`文件夹 | ||||||
|  | 
 | ||||||
| Your app lives in the `src` folder. | Your app lives in the `src` folder. | ||||||
| All Angular components, templates, styles, images, and anything else your app needs go here. | All Angular components, templates, styles, images, and anything else your app needs go here. | ||||||
| Any files outside of this folder are meant to support building your app. | Any files outside of this folder are meant to support building your app. | ||||||
| 
 | 
 | ||||||
|  | 你的应用代码位于`src`文件夹中。 | ||||||
|  | 所有的Angular组件、模板、样式、图片以及你的应用所需的任何东西都在那里。 | ||||||
|  | 这个文件夹之外的文件都是为构建应用提供支持用的。 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| <div class='filetree'> | <div class='filetree'> | ||||||
|   <div class='file'>src</div> |   <div class='file'>src</div> | ||||||
| @ -243,9 +343,15 @@ Any files outside of this folder are meant to support building your app. | |||||||
|   <tr> |   <tr> | ||||||
|     <th> |     <th> | ||||||
|       File |       File | ||||||
|  |        | ||||||
|  |       文件 | ||||||
|  |        | ||||||
|     </th> |     </th> | ||||||
|     <th> |     <th> | ||||||
|       Purpose |       Purpose | ||||||
|  |        | ||||||
|  |       用途 | ||||||
|  |        | ||||||
|     </th> |     </th> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -260,6 +366,9 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       It is the **root** component of what will become a tree of nested components |       It is the **root** component of what will become a tree of nested components | ||||||
|       as the application evolves. |       as the application evolves. | ||||||
| 
 | 
 | ||||||
|  |       使用HTML模板、CSS样式和单元测试定义`AppComponent`组件。 | ||||||
|  |       它是**根**组件,随着应用的成长它会成为一棵组件树的根节点。 | ||||||
|  |        | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -274,6 +383,10 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       Right now it declares only the `AppComponent`. |       Right now it declares only the `AppComponent`. | ||||||
|       Soon there will be more components to declare. |       Soon there will be more components to declare. | ||||||
| 
 | 
 | ||||||
|  |       定义`AppModule`,这个[根模块](guide/bootstrapping "AppModule: 根模块")会告诉Angular如何组装该应用。 | ||||||
|  |       目前,它只声明了`AppComponent`。 | ||||||
|  |       稍后它还会声明更多组件。 | ||||||
|  |        | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -287,6 +400,7 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       A folder where you can put images and anything else to be copied wholesale |       A folder where you can put images and anything else to be copied wholesale | ||||||
|       when you build your application. |       when you build your application. | ||||||
| 
 | 
 | ||||||
|  |       这个文件夹下你可以放图片等任何东西,在构建应用时,它们全都会拷贝到发布包中。 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -305,6 +419,12 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       You might even use some mock services. |       You might even use some mock services. | ||||||
|       Either way, the CLI has you covered. |       Either way, the CLI has you covered. | ||||||
| 
 | 
 | ||||||
|  |       这个文件夹中包括为各个目标环境准备的文件,它们导出了一些应用中要用到的配置变量。 | ||||||
|  |       这些文件会在构建应用时被替换。 | ||||||
|  |       比如你可能在产品环境中使用不同的API端点地址,或使用不同的统计Token参数。 | ||||||
|  |       甚至使用一些模拟服务。 | ||||||
|  |       所有这些,CLI都替你考虑到了。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -318,6 +438,8 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       Every site wants to look good on the bookmark bar. |       Every site wants to look good on the bookmark bar. | ||||||
|       Get started with your very own Angular icon. |       Get started with your very own Angular icon. | ||||||
| 
 | 
 | ||||||
|  |       每个网站都希望自己在书签栏中能好看一点。 | ||||||
|  |       请把它换成你自己的图标。 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -333,6 +455,10 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       The CLI automatically adds all `js` and `css` files when building your app so you |       The CLI automatically adds all `js` and `css` files when building your app so you | ||||||
|       never need to add any `<script>` or `<link>` tags here manually. |       never need to add any `<script>` or `<link>` tags here manually. | ||||||
| 
 | 
 | ||||||
|  |       这是别人访问你的网站是看到的主页面的HTML文件。 | ||||||
|  |       大多数情况下你都不用编辑它。 | ||||||
|  |       在构建应用时,CLI会自动把所有`js`和`css`文件添加进去,所以你不必在这里手动添加任何 `<script>` 或 `<link>` 标签。 | ||||||
|  |        | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -349,6 +475,10 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       You can also use the [AOT compiler](guide/glossary#ahead-of-time-aot-compilation) |       You can also use the [AOT compiler](guide/glossary#ahead-of-time-aot-compilation) | ||||||
|       without changing any code by passing in `--aot` to `ng build` or `ng serve`. |       without changing any code by passing in `--aot` to `ng build` or `ng serve`. | ||||||
| 
 | 
 | ||||||
|  |       这是应用的主要入口点。 | ||||||
|  |       使用[JIT compiler](guide/glossary#jit)编译器编译本应用,并[启动应用的根模块`AppModule`](guide/guide/appmodule#main "启动应用"),使其运行在浏览器中。 | ||||||
|  |       你还可以使用[AOT compiler](guide/glossary#ahead-of-time-aot-compilation)编译器,而不用修改任何代码 —— 只要给`ng build` 或 `ng serve` 传入 `--aot` 参数就可以了。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -364,6 +494,10 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       You should be pretty safe with `core-js` and `zone.js`, but be sure to check out |       You should be pretty safe with `core-js` and `zone.js`, but be sure to check out | ||||||
|       the [Browser Support guide](guide/browser-support) for more information. |       the [Browser Support guide](guide/browser-support) for more information. | ||||||
| 
 | 
 | ||||||
|  |       不同的浏览器对Web标准的支持程度也不同。 | ||||||
|  |       填充库(polyfill)能帮我们把这些不同点进行标准化。 | ||||||
|  |       你只要使用`core-js` 和 `zone.js`通常就够了,不过你也可以查看[浏览器支持指南](guide/browser-support)以了解更多信息。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -378,6 +512,9 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       Most of the time you'll want to have local styles in your components for easier maintenance, |       Most of the time you'll want to have local styles in your components for easier maintenance, | ||||||
|       but styles that affect all of your app need to be in a central place. |       but styles that affect all of your app need to be in a central place. | ||||||
| 
 | 
 | ||||||
|  |       这里是你的全局样式。 | ||||||
|  |       大多数情况下,你会希望在组件中使用局部样式,以利于维护,不过那些会影响你整个应用的样式你还是需要集中存放在这里。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -391,6 +528,10 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       This is the main entry point for your unit tests. |       This is the main entry point for your unit tests. | ||||||
|       It has some custom configuration that might be unfamiliar, but it's not something you'll |       It has some custom configuration that might be unfamiliar, but it's not something you'll | ||||||
|       need to edit. |       need to edit. | ||||||
|  | 
 | ||||||
|  |       这是单元测试的主要入口点。 | ||||||
|  |       它有一些你不熟悉的自定义配置,不过你并不需要编辑这里的任何东西。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -403,16 +544,24 @@ Any files outside of this folder are meant to support building your app. | |||||||
|       TypeScript compiler configuration for the Angular app (`tsconfig.app.json`) |       TypeScript compiler configuration for the Angular app (`tsconfig.app.json`) | ||||||
|       and for the unit tests (`tsconfig.spec.json`). |       and for the unit tests (`tsconfig.spec.json`). | ||||||
| 
 | 
 | ||||||
|  |       TypeScript编译器的配置文件。`tsconfig.app.json`是为Angular应用准备的,而`tsconfig.spec.json`是为单元测试准备的。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
| </table> | </table> | ||||||
| 
 | 
 | ||||||
| ### The root folder | ### The root folder | ||||||
| 
 | 
 | ||||||
|  | ### 根目录 | ||||||
|  | 
 | ||||||
| The `src/` folder is just one of the items inside the project's root folder. | The `src/` folder is just one of the items inside the project's root folder. | ||||||
| Other files help you build, test, maintain, document, and deploy the app. | Other files help you build, test, maintain, document, and deploy the app. | ||||||
| These files go in the root folder next to `src/`. | These files go in the root folder next to `src/`. | ||||||
| 
 | 
 | ||||||
|  | `src/`文件夹是项目的根文件夹之一。 | ||||||
|  | 其它文件是用来帮助你构建、测试、维护、文档化和发布应用的。它们放在根目录下,和`src/`平级。 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| <div class='filetree'> | <div class='filetree'> | ||||||
|   <div class="file">my-app</div> |   <div class="file">my-app</div> | ||||||
| @ -451,9 +600,15 @@ These files go in the root folder next to `src/`. | |||||||
|   <tr> |   <tr> | ||||||
|     <th> |     <th> | ||||||
|       File |       File | ||||||
|  |        | ||||||
|  |       文件 | ||||||
|  |        | ||||||
|     </th> |     </th> | ||||||
|     <th> |     <th> | ||||||
|       Purpose |       Purpose | ||||||
|  |        | ||||||
|  |       用途 | ||||||
|  |        | ||||||
|     </th> |     </th> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -469,6 +624,10 @@ These files go in the root folder next to `src/`. | |||||||
|       just so happens to test your main app. |       just so happens to test your main app. | ||||||
|       That's also why they have their own `tsconfig.e2e.json`. |       That's also why they have their own `tsconfig.e2e.json`. | ||||||
| 
 | 
 | ||||||
|  |       在`e2e/`下是端到端(end-to-end)测试。 | ||||||
|  |       它们不在`src/`下,是因为端到端测试实际上和应用是相互独立的,它只适用于测试你的应用而已。 | ||||||
|  |       这也就是为什么它会拥有自己的`tsconfig.json`。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -481,6 +640,9 @@ These files go in the root folder next to `src/`. | |||||||
| 
 | 
 | ||||||
|       `Node.js` creates this folder and puts all third party modules listed in |       `Node.js` creates this folder and puts all third party modules listed in | ||||||
|       `package.json` inside of it. |       `package.json` inside of it. | ||||||
|  | 
 | ||||||
|  |       `Node.js`创建了这个文件夹,并且把`package.json`中列举的所有第三方模块都放在其中。 | ||||||
|  |        | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -496,6 +658,10 @@ These files go in the root folder next to `src/`. | |||||||
|       when your project is built. |       when your project is built. | ||||||
|       Check out the official documentation if you want to know more. |       Check out the official documentation if you want to know more. | ||||||
| 
 | 
 | ||||||
|  |       Angular CLI的配置文件。 | ||||||
|  |       在这个文件中,我们可以设置一系列默认值,还可以配置项目编译时要包含的那些文件。 | ||||||
|  |       要了解更多,请参阅它的官方文档。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -511,6 +677,9 @@ These files go in the root folder next to `src/`. | |||||||
|       Most editors support an `.editorconfig` file. |       Most editors support an `.editorconfig` file. | ||||||
|       See http://editorconfig.org for more information. |       See http://editorconfig.org for more information. | ||||||
| 
 | 
 | ||||||
|  |       给你的编辑器看的一个简单配置文件,它用来确保参与你项目的每个人都具有基本的编辑器配置。 | ||||||
|  |       大多数的编辑器都支持`.editorconfig`文件,详情参见 http://editorconfig.org 。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -523,6 +692,8 @@ These files go in the root folder next to `src/`. | |||||||
| 
 | 
 | ||||||
|       Git configuration to make sure autogenerated files are not commited to source control. |       Git configuration to make sure autogenerated files are not commited to source control. | ||||||
| 
 | 
 | ||||||
|  |       一个Git的配置文件,用来确保某些自动生成的文件不会被提交到源码控制系统中。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -536,6 +707,8 @@ These files go in the root folder next to `src/`. | |||||||
|       Unit test configuration for the [Karma test runner](https://karma-runner.github.io), |       Unit test configuration for the [Karma test runner](https://karma-runner.github.io), | ||||||
|       used when running `ng test`. |       used when running `ng test`. | ||||||
| 
 | 
 | ||||||
|  |       给[Karma](https://karma-runner.github.io)的单元测试配置,当运行`ng test`时会用到它。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -549,6 +722,9 @@ These files go in the root folder next to `src/`. | |||||||
|       `npm` configuration listing the third party packages your project uses. |       `npm` configuration listing the third party packages your project uses. | ||||||
|       You can also add your own [custom scripts](https://docs.npmjs.com/misc/scripts) here. |       You can also add your own [custom scripts](https://docs.npmjs.com/misc/scripts) here. | ||||||
| 
 | 
 | ||||||
|  |       `npm`配置文件,其中列出了项目使用到的第三方依赖包。 | ||||||
|  |       你还可以在这里添加自己的[自定义脚本](https://docs.npmjs.com/misc/scripts)。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -562,6 +738,8 @@ These files go in the root folder next to `src/`. | |||||||
|       End-to-end test configuration for [Protractor](http://www.protractortest.org/), |       End-to-end test configuration for [Protractor](http://www.protractortest.org/), | ||||||
|       used when running `ng e2e`. |       used when running `ng e2e`. | ||||||
| 
 | 
 | ||||||
|  |       给[Protractor](http://www.protractortest.org/)使用的端到端测试配置文件,当运行`ng e2e`的时候会用到它。 | ||||||
|  |        | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -576,6 +754,9 @@ These files go in the root folder next to `src/`. | |||||||
|       Make sure to enhance it with project documentation so that anyone |       Make sure to enhance it with project documentation so that anyone | ||||||
|       checking out the repo can build your app! |       checking out the repo can build your app! | ||||||
| 
 | 
 | ||||||
|  |       项目的基础文档,预先写入了CLI命令的信息。 | ||||||
|  |       别忘了用项目文档改进它,以便每个查看此仓库的人都能据此构建出你的应用。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -588,6 +769,8 @@ These files go in the root folder next to `src/`. | |||||||
| 
 | 
 | ||||||
|       TypeScript compiler configuration for your IDE to pick up and give you helpful tooling. |       TypeScript compiler configuration for your IDE to pick up and give you helpful tooling. | ||||||
| 
 | 
 | ||||||
|  |       TypeScript编译器的配置,你的IDE会借助它来给你提供更好的帮助。 | ||||||
|  |        | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
|   <tr> |   <tr> | ||||||
| @ -602,6 +785,9 @@ These files go in the root folder next to `src/`. | |||||||
|       [Codelyzer](http://codelyzer.com/), used when running `ng lint`. |       [Codelyzer](http://codelyzer.com/), used when running `ng lint`. | ||||||
|       Linting helps keep your code style consistent. |       Linting helps keep your code style consistent. | ||||||
| 
 | 
 | ||||||
|  |       给[TSLint](https://palantir.github.io/tslint/)和[Codelyzer](http://codelyzer.com/)用的配置信息,当运行`ng lint`时会用到。 | ||||||
|  |       Lint功能可以帮你保持代码风格的统一。 | ||||||
|  | 
 | ||||||
|     </td> |     </td> | ||||||
|   </tr> |   </tr> | ||||||
| </table> | </table> | ||||||
| @ -610,8 +796,13 @@ These files go in the root folder next to `src/`. | |||||||
| 
 | 
 | ||||||
| ### Next Step | ### Next Step | ||||||
| 
 | 
 | ||||||
|  | ### 下一步 | ||||||
|  | 
 | ||||||
| If you're new to Angular, continue with the | If you're new to Angular, continue with the | ||||||
| [tutorial](tutorial "Tour of Heroes tutorial"). | [tutorial](tutorial "Tour of Heroes tutorial"). | ||||||
| You can skip the "Setup" step since you're already using the Angular CLI setup. | You can skip the "Setup" step since you're already using the Angular CLI setup. | ||||||
| 
 | 
 | ||||||
|  | 如果你刚刚开始使用Angular,我们建议你遵循这个[教程](tutorial "《英雄指南》教程")。 | ||||||
|  | 你可以跳过“环境设置”一章,因为你已经在使用 Angular-CLI 设置好环境了。 | ||||||
|  | 
 | ||||||
| </div> | </div> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user