218 lines
7.8 KiB
Markdown
Raw Normal View History

2017-11-06 19:02:18 +01:00
# The Application Shell
You begin by creating an initial application using the Angular CLI. Throughout this tutorial, youll modify and extend that starter application to create the Tour of Heroes app.
2018-03-08 13:09:40 +08:00
In this part of the tutorial, you'll do the following:
2017-11-06 19:02:18 +01:00
1. Set up your environment.
2. Create a new workspace and initial app project.
3. Serve the application.
4. Make changes to the application.
2018-03-08 13:09:40 +08:00
## Set up your environment
2017-11-06 19:02:18 +01:00
To set up your development environment, follow these instructions in [Getting Started](guide/quickstart):
2017-11-06 19:02:18 +01:00
* [Prerequisites](guide/quickstart#prerequisites)
* [Install the Angular CLI](guide/quickstart#install-cli)
2017-11-06 19:02:18 +01:00
<div class="alert is-helpful">
2018-03-08 13:09:40 +08:00
**Note:**: You do not need to complete the entire Getting Started. After you complete the above two sections of Getting Started, your environment is set up. Continue below to create the Tour of Heroes workspace and an initial app project.
</div>
2017-11-06 19:02:18 +01:00
2018-03-08 13:09:40 +08:00
## Create a new workspace and an initial application
2017-11-06 19:02:18 +01:00
You develop apps in the context of an Angular [workspace](guide/glossary#workspace). A workspace contains the files for one or more [projects](guide/glossary#project). A project is the set of files that comprise an app, a library, or end-to-end (e2e) tests. For this tutorial, you will create a new workspace.
2017-11-06 19:02:18 +01:00
To create a new workspace and an initial app project:
2018-03-08 13:09:40 +08:00
1. Ensure that you are not already in an Angular workspace folder. For example, if you have previously created the Getting Started workspace, change to the parent of that folder.
2. Run the CLI command `ng new` and provide the name `angular-tour-of-heroes`, as shown here:
Merge remote-tracking branch 'en/master' into aio # Conflicts: # aio/content/guide/ajs-quick-reference.md # aio/content/guide/animations.md # aio/content/guide/aot-compiler.md # aio/content/guide/architecture-components.md # aio/content/guide/architecture-modules.md # aio/content/guide/architecture-next-steps.md # aio/content/guide/architecture-services.md # aio/content/guide/architecture.md # aio/content/guide/attribute-directives.md # aio/content/guide/bootstrapping.md # aio/content/guide/browser-support.md # aio/content/guide/cheatsheet.md # aio/content/guide/comparing-observables.md # aio/content/guide/component-interaction.md # aio/content/guide/component-styles.md # aio/content/guide/dependency-injection-in-action.md # aio/content/guide/dependency-injection-pattern.md # aio/content/guide/dependency-injection.md # aio/content/guide/deployment.md # aio/content/guide/displaying-data.md # aio/content/guide/dynamic-component-loader.md # aio/content/guide/elements.md # aio/content/guide/feature-modules.md # aio/content/guide/form-validation.md # aio/content/guide/forms.md # aio/content/guide/glossary.md # aio/content/guide/hierarchical-dependency-injection.md # aio/content/guide/i18n.md # aio/content/guide/lazy-loading-ngmodules.md # aio/content/guide/lifecycle-hooks.md # aio/content/guide/ngmodule-faq.md # aio/content/guide/ngmodule-vs-jsmodule.md # aio/content/guide/ngmodules.md # aio/content/guide/npm-packages.md # aio/content/guide/observables-in-angular.md # aio/content/guide/observables.md # aio/content/guide/pipes.md # aio/content/guide/practical-observable-usage.md # aio/content/guide/providers.md # aio/content/guide/quickstart.md # aio/content/guide/reactive-forms.md # aio/content/guide/router.md # aio/content/guide/rx-library.md # aio/content/guide/security.md # aio/content/guide/service-worker-communications.md # aio/content/guide/service-worker-getting-started.md # aio/content/guide/service-worker-intro.md # aio/content/guide/setup-systemjs-anatomy.md # aio/content/guide/setup.md # aio/content/guide/singleton-services.md # aio/content/guide/structural-directives.md # aio/content/guide/styleguide.md # aio/content/guide/template-syntax.md # aio/content/guide/testing.md # aio/content/guide/typescript-configuration.md # aio/content/guide/universal.md # aio/content/guide/updating.md # aio/content/guide/upgrade.md # aio/content/guide/user-input.md # aio/content/guide/visual-studio-2015.md # aio/content/marketing/docs.md # aio/content/navigation.json # aio/content/tutorial/toh-pt0.md # aio/content/tutorial/toh-pt1.md # aio/content/tutorial/toh-pt2.md # aio/content/tutorial/toh-pt3.md # aio/content/tutorial/toh-pt4.md # aio/content/tutorial/toh-pt5.md # aio/content/tutorial/toh-pt6.md # aio/ngsw-manifest.json # aio/package.json # aio/src/app/custom-elements/api/api-list.component.html # aio/src/app/custom-elements/api/api-list.component.ts # aio/src/index.html # aio/tools/transforms/templates/api/base.template.html # aio/tools/transforms/templates/api/class.template.html # aio/tools/transforms/templates/api/directive.template.html # aio/tools/transforms/templates/api/enum.template.html # aio/tools/transforms/templates/api/includes/class-overview.html # aio/tools/transforms/templates/api/includes/deprecation.html # aio/tools/transforms/templates/api/includes/export-as.html # aio/tools/transforms/templates/api/includes/info-bar.html # aio/tools/transforms/templates/api/includes/interface-overview.html # aio/tools/transforms/templates/api/includes/selectors.html # aio/tools/transforms/templates/api/lib/directiveHelpers.html # aio/tools/transforms/templates/api/lib/githubLinks.html # aio/tools/transforms/templates/api/lib/memberHelpers.html # aio/tools/transforms/templates/api/package.template.html # aio/yarn.lock # packages/common/http/src/module.ts # packages/common/src/common_module.ts # packages/common/src/directives/ng_for_of.ts # packages/common/src/directives/ng_if.ts # packages/common/src/directives/ng_template_outlet.ts # packages/common/src/location/location.ts # packages/common/src/pipes/async_pipe.ts # packages/common/src/pipes/json_pipe.ts # packages/common/src/pipes/number_pipe.ts # packages/common/src/pipes/slice_pipe.ts # packages/core/src/change_detection/change_detector_ref.ts # packages/core/src/di/injectable.ts # packages/core/src/linker/template_ref.ts # packages/core/src/linker/view_container_ref.ts # packages/core/src/metadata/di.ts # packages/core/src/metadata/ng_module.ts # packages/core/src/render/api.ts # packages/forms/src/directives/form_interface.ts # packages/forms/src/directives/ng_form.ts # packages/forms/src/directives/ng_model.ts # packages/forms/src/directives/reactive_directives/form_control_name.ts # packages/forms/src/directives/select_control_value_accessor.ts # packages/forms/src/directives/validators.ts # packages/forms/src/form_providers.ts # packages/forms/src/model.ts # packages/forms/src/validators.ts # packages/router/src/config.ts # packages/router/src/router.ts # packages/router/src/router_module.ts # packages/router/src/router_state.ts
2018-10-21 17:43:29 +08:00
使用 CLI 命令创建一个名叫 `angular-tour-of-heroes` 的新项目。
2018-05-15 13:32:40 +08:00
Merge remote-tracking branch 'en/master' into aio # Conflicts: # aio/content/guide/ajs-quick-reference.md # aio/content/guide/animations.md # aio/content/guide/aot-compiler.md # aio/content/guide/architecture-components.md # aio/content/guide/architecture-modules.md # aio/content/guide/architecture-next-steps.md # aio/content/guide/architecture-services.md # aio/content/guide/architecture.md # aio/content/guide/attribute-directives.md # aio/content/guide/bootstrapping.md # aio/content/guide/browser-support.md # aio/content/guide/cheatsheet.md # aio/content/guide/comparing-observables.md # aio/content/guide/component-interaction.md # aio/content/guide/component-styles.md # aio/content/guide/dependency-injection-in-action.md # aio/content/guide/dependency-injection-pattern.md # aio/content/guide/dependency-injection.md # aio/content/guide/deployment.md # aio/content/guide/displaying-data.md # aio/content/guide/dynamic-component-loader.md # aio/content/guide/elements.md # aio/content/guide/feature-modules.md # aio/content/guide/form-validation.md # aio/content/guide/forms.md # aio/content/guide/glossary.md # aio/content/guide/hierarchical-dependency-injection.md # aio/content/guide/i18n.md # aio/content/guide/lazy-loading-ngmodules.md # aio/content/guide/lifecycle-hooks.md # aio/content/guide/ngmodule-faq.md # aio/content/guide/ngmodule-vs-jsmodule.md # aio/content/guide/ngmodules.md # aio/content/guide/npm-packages.md # aio/content/guide/observables-in-angular.md # aio/content/guide/observables.md # aio/content/guide/pipes.md # aio/content/guide/practical-observable-usage.md # aio/content/guide/providers.md # aio/content/guide/quickstart.md # aio/content/guide/reactive-forms.md # aio/content/guide/router.md # aio/content/guide/rx-library.md # aio/content/guide/security.md # aio/content/guide/service-worker-communications.md # aio/content/guide/service-worker-getting-started.md # aio/content/guide/service-worker-intro.md # aio/content/guide/setup-systemjs-anatomy.md # aio/content/guide/setup.md # aio/content/guide/singleton-services.md # aio/content/guide/structural-directives.md # aio/content/guide/styleguide.md # aio/content/guide/template-syntax.md # aio/content/guide/testing.md # aio/content/guide/typescript-configuration.md # aio/content/guide/universal.md # aio/content/guide/updating.md # aio/content/guide/upgrade.md # aio/content/guide/user-input.md # aio/content/guide/visual-studio-2015.md # aio/content/marketing/docs.md # aio/content/navigation.json # aio/content/tutorial/toh-pt0.md # aio/content/tutorial/toh-pt1.md # aio/content/tutorial/toh-pt2.md # aio/content/tutorial/toh-pt3.md # aio/content/tutorial/toh-pt4.md # aio/content/tutorial/toh-pt5.md # aio/content/tutorial/toh-pt6.md # aio/ngsw-manifest.json # aio/package.json # aio/src/app/custom-elements/api/api-list.component.html # aio/src/app/custom-elements/api/api-list.component.ts # aio/src/index.html # aio/tools/transforms/templates/api/base.template.html # aio/tools/transforms/templates/api/class.template.html # aio/tools/transforms/templates/api/directive.template.html # aio/tools/transforms/templates/api/enum.template.html # aio/tools/transforms/templates/api/includes/class-overview.html # aio/tools/transforms/templates/api/includes/deprecation.html # aio/tools/transforms/templates/api/includes/export-as.html # aio/tools/transforms/templates/api/includes/info-bar.html # aio/tools/transforms/templates/api/includes/interface-overview.html # aio/tools/transforms/templates/api/includes/selectors.html # aio/tools/transforms/templates/api/lib/directiveHelpers.html # aio/tools/transforms/templates/api/lib/githubLinks.html # aio/tools/transforms/templates/api/lib/memberHelpers.html # aio/tools/transforms/templates/api/package.template.html # aio/yarn.lock # packages/common/http/src/module.ts # packages/common/src/common_module.ts # packages/common/src/directives/ng_for_of.ts # packages/common/src/directives/ng_if.ts # packages/common/src/directives/ng_template_outlet.ts # packages/common/src/location/location.ts # packages/common/src/pipes/async_pipe.ts # packages/common/src/pipes/json_pipe.ts # packages/common/src/pipes/number_pipe.ts # packages/common/src/pipes/slice_pipe.ts # packages/core/src/change_detection/change_detector_ref.ts # packages/core/src/di/injectable.ts # packages/core/src/linker/template_ref.ts # packages/core/src/linker/view_container_ref.ts # packages/core/src/metadata/di.ts # packages/core/src/metadata/ng_module.ts # packages/core/src/render/api.ts # packages/forms/src/directives/form_interface.ts # packages/forms/src/directives/ng_form.ts # packages/forms/src/directives/ng_model.ts # packages/forms/src/directives/reactive_directives/form_control_name.ts # packages/forms/src/directives/select_control_value_accessor.ts # packages/forms/src/directives/validators.ts # packages/forms/src/form_providers.ts # packages/forms/src/model.ts # packages/forms/src/validators.ts # packages/router/src/config.ts # packages/router/src/router.ts # packages/router/src/router_module.ts # packages/router/src/router_state.ts
2018-10-21 17:43:29 +08:00
<code-example language="sh" class="code-shell">
ng new angular-tour-of-heroes
</code-example>
2018-05-15 13:32:40 +08:00
3. The `ng new` command prompts you for information about features to include in the initial app project. Accept the defaults by pressing the Enter or Return key.
2018-05-15 13:32:40 +08:00
The Angular CLI installs the necessary Angular `npm` packages and other dependencies. This can take a few minutes.
2018-05-15 13:32:40 +08:00
It also creates the following workspace and starter project files:
2018-05-15 13:32:40 +08:00
* A new workspace, with a root folder named `angular-tour-of-heroes`.
* An initial skeleton app project, also called `angular-tour-of-heroes` (in the `src` subfolder).
* An end-to-end test project (in the e2e subfolder).
* Related configuration files.
The initial app project contains a simple Welcome app, ready to run.
2018-05-15 13:32:40 +08:00
2017-11-06 19:02:18 +01:00
## Serve the application
2018-03-08 13:09:40 +08:00
## 启动应用服务器
Go to the workspace directory and launch the application.
2017-11-06 19:02:18 +01:00
2018-03-08 13:09:40 +08:00
进入项目目录,并启动这个应用。
2017-11-06 19:02:18 +01:00
<code-example language="sh" class="code-shell">
cd angular-tour-of-heroes
ng serve --open
</code-example>
2018-03-03 21:06:01 +08:00
<div class="alert is-helpful">
2017-11-06 19:02:18 +01:00
The `ng serve` command builds the app, starts the development server,
watches the source files, and rebuilds the app as you make changes to those files.
2018-03-08 13:09:40 +08:00
`ng serve` 命令会构建本应用、启动开发服务器、监听源文件,并且当那些文件发生变化时重新构建本应用。
2017-11-06 19:02:18 +01:00
The `--open` flag opens a browser to `http://localhost:4200/`.
2018-03-08 13:09:40 +08:00
`--open` 标志会打开浏览器,并访问 `http://localhost:4200/`
2017-11-06 19:02:18 +01:00
</div>
You should see the app running in your browser.
2018-03-08 13:09:40 +08:00
你会发现本应用正运行在浏览器中。
2017-11-06 19:02:18 +01:00
## Angular components
2018-03-08 13:09:40 +08:00
## Angular 组件
2017-11-06 19:02:18 +01:00
The page you see is the _application shell_.
The shell is controlled by an Angular **component** named `AppComponent`.
2018-03-08 13:09:40 +08:00
你所看到的这个页面就是*应用的外壳*。
这个外壳是被一个名叫 `AppComponent` 的 Angular 组件控制的。
2017-11-06 19:02:18 +01:00
_Components_ are the fundamental building blocks of Angular applications.
They display data on the screen, listen for user input, and take action based on that input.
2018-03-08 13:09:40 +08:00
*组件*是 Angular 应用中的基本构造块。
它们在屏幕上显示数据,监听用户输入,并且根据这些输入执行相应的动作。
## Make changes to the application
2017-11-06 19:02:18 +01:00
2018-03-08 13:09:40 +08:00
## 修改应用标题
Open the project in your favorite editor or IDE and navigate to the `src/app` folder to make some changes to the starter app.
2017-11-06 19:02:18 +01:00
2018-03-08 13:09:40 +08:00
用你最喜欢的编辑器或 IDE 打开这个项目,并访问 `src/app` 目录。
2017-11-06 19:02:18 +01:00
You'll find the implementation of the shell `AppComponent` distributed over three files:
2018-03-08 13:09:40 +08:00
你会在这里看到 `AppComponent` 壳的三个实现文件:
2017-11-06 19:02:18 +01:00
1. `app.component.ts`&mdash; the component class code, written in TypeScript.
2018-03-03 21:06:01 +08:00
2018-03-08 13:09:40 +08:00
`app.component.ts`&mdash; 组件的类代码,这是用 TypeScript 写的。
2017-11-06 19:02:18 +01:00
1. `app.component.html`&mdash; the component template, written in HTML.
`app.component.html`&mdash; 组件的模板,这是用 HTML 写的。
2018-03-08 13:09:40 +08:00
2018-03-03 21:06:01 +08:00
1. `app.component.css`&mdash; the component's private CSS styles.
2017-11-06 19:02:18 +01:00
`app.component.css`&mdash; 组件的私有 CSS 样式。
2018-03-08 13:09:40 +08:00
### Change the application title
2017-11-06 19:02:18 +01:00
Merge remote-tracking branch 'en/master' into aio # Conflicts: # aio/content/guide/ajs-quick-reference.md # aio/content/guide/animations.md # aio/content/guide/aot-compiler.md # aio/content/guide/architecture-components.md # aio/content/guide/architecture-modules.md # aio/content/guide/architecture-next-steps.md # aio/content/guide/architecture-services.md # aio/content/guide/architecture.md # aio/content/guide/attribute-directives.md # aio/content/guide/bootstrapping.md # aio/content/guide/browser-support.md # aio/content/guide/cheatsheet.md # aio/content/guide/comparing-observables.md # aio/content/guide/component-interaction.md # aio/content/guide/component-styles.md # aio/content/guide/dependency-injection-in-action.md # aio/content/guide/dependency-injection-pattern.md # aio/content/guide/dependency-injection.md # aio/content/guide/deployment.md # aio/content/guide/displaying-data.md # aio/content/guide/dynamic-component-loader.md # aio/content/guide/elements.md # aio/content/guide/feature-modules.md # aio/content/guide/form-validation.md # aio/content/guide/forms.md # aio/content/guide/glossary.md # aio/content/guide/hierarchical-dependency-injection.md # aio/content/guide/i18n.md # aio/content/guide/lazy-loading-ngmodules.md # aio/content/guide/lifecycle-hooks.md # aio/content/guide/ngmodule-faq.md # aio/content/guide/ngmodule-vs-jsmodule.md # aio/content/guide/ngmodules.md # aio/content/guide/npm-packages.md # aio/content/guide/observables-in-angular.md # aio/content/guide/observables.md # aio/content/guide/pipes.md # aio/content/guide/practical-observable-usage.md # aio/content/guide/providers.md # aio/content/guide/quickstart.md # aio/content/guide/reactive-forms.md # aio/content/guide/router.md # aio/content/guide/rx-library.md # aio/content/guide/security.md # aio/content/guide/service-worker-communications.md # aio/content/guide/service-worker-getting-started.md # aio/content/guide/service-worker-intro.md # aio/content/guide/setup-systemjs-anatomy.md # aio/content/guide/setup.md # aio/content/guide/singleton-services.md # aio/content/guide/structural-directives.md # aio/content/guide/styleguide.md # aio/content/guide/template-syntax.md # aio/content/guide/testing.md # aio/content/guide/typescript-configuration.md # aio/content/guide/universal.md # aio/content/guide/updating.md # aio/content/guide/upgrade.md # aio/content/guide/user-input.md # aio/content/guide/visual-studio-2015.md # aio/content/marketing/docs.md # aio/content/navigation.json # aio/content/tutorial/toh-pt0.md # aio/content/tutorial/toh-pt1.md # aio/content/tutorial/toh-pt2.md # aio/content/tutorial/toh-pt3.md # aio/content/tutorial/toh-pt4.md # aio/content/tutorial/toh-pt5.md # aio/content/tutorial/toh-pt6.md # aio/ngsw-manifest.json # aio/package.json # aio/src/app/custom-elements/api/api-list.component.html # aio/src/app/custom-elements/api/api-list.component.ts # aio/src/index.html # aio/tools/transforms/templates/api/base.template.html # aio/tools/transforms/templates/api/class.template.html # aio/tools/transforms/templates/api/directive.template.html # aio/tools/transforms/templates/api/enum.template.html # aio/tools/transforms/templates/api/includes/class-overview.html # aio/tools/transforms/templates/api/includes/deprecation.html # aio/tools/transforms/templates/api/includes/export-as.html # aio/tools/transforms/templates/api/includes/info-bar.html # aio/tools/transforms/templates/api/includes/interface-overview.html # aio/tools/transforms/templates/api/includes/selectors.html # aio/tools/transforms/templates/api/lib/directiveHelpers.html # aio/tools/transforms/templates/api/lib/githubLinks.html # aio/tools/transforms/templates/api/lib/memberHelpers.html # aio/tools/transforms/templates/api/package.template.html # aio/yarn.lock # packages/common/http/src/module.ts # packages/common/src/common_module.ts # packages/common/src/directives/ng_for_of.ts # packages/common/src/directives/ng_if.ts # packages/common/src/directives/ng_template_outlet.ts # packages/common/src/location/location.ts # packages/common/src/pipes/async_pipe.ts # packages/common/src/pipes/json_pipe.ts # packages/common/src/pipes/number_pipe.ts # packages/common/src/pipes/slice_pipe.ts # packages/core/src/change_detection/change_detector_ref.ts # packages/core/src/di/injectable.ts # packages/core/src/linker/template_ref.ts # packages/core/src/linker/view_container_ref.ts # packages/core/src/metadata/di.ts # packages/core/src/metadata/ng_module.ts # packages/core/src/render/api.ts # packages/forms/src/directives/form_interface.ts # packages/forms/src/directives/ng_form.ts # packages/forms/src/directives/ng_model.ts # packages/forms/src/directives/reactive_directives/form_control_name.ts # packages/forms/src/directives/select_control_value_accessor.ts # packages/forms/src/directives/validators.ts # packages/forms/src/form_providers.ts # packages/forms/src/model.ts # packages/forms/src/validators.ts # packages/router/src/config.ts # packages/router/src/router.ts # packages/router/src/router_module.ts # packages/router/src/router_state.ts
2018-10-21 17:43:29 +08:00
### 更改应用标题
2017-11-06 19:02:18 +01:00
Open the component class file (`app.component.ts`) and change the value of the `title` property to 'Tour of Heroes'.
2018-03-08 13:09:40 +08:00
打开组件的类文件 (`app.component.ts`),并把 `title` 属性的值修改为 'Tour of Heroes' (英雄指南)。
<code-example path="toh-pt0/src/app/app.component.ts" region="set-title" header="app.component.ts (class title property)" linenums="false">
2017-11-06 19:02:18 +01:00
</code-example>
Open the component template file (`app.component.html`) and
2017-11-06 19:02:18 +01:00
delete the default template generated by the Angular CLI.
Replace it with the following line of HTML.
2018-03-08 13:09:40 +08:00
打开组件的模板文件 `app.component.html` 并清空 Angular CLI 自动生成的默认模板。改为下列 HTML 内容:
<code-example path="toh-pt0/src/app/app.component.html"
header="app.component.html (template)" linenums="false">
2017-11-06 19:02:18 +01:00
</code-example>
The double curly braces are Angular's *interpolation binding* syntax.
This interpolation binding presents the component's `title` property value
2017-11-06 19:02:18 +01:00
inside the HTML header tag.
2018-03-08 13:09:40 +08:00
双花括号语法是 Angular 的*插值绑定*语法。
2018-03-08 17:07:55 +08:00
这个插值绑定的意思是把组件的 `title` 属性的值绑定到 HTML 中的 `h1` 标记中。
2018-03-08 13:09:40 +08:00
2017-11-06 19:02:18 +01:00
The browser refreshes and displays the new application title.
2018-03-08 13:09:40 +08:00
浏览器自动刷新,并且显示出了新的应用标题。
2017-11-06 19:02:18 +01:00
{@a app-wide-styles}
### Add application styles
2017-11-06 19:02:18 +01:00
2018-03-08 13:09:40 +08:00
## 添加应用样式
2017-11-06 19:02:18 +01:00
Most apps strive for a consistent look across the application.
The CLI generated an empty `styles.css` for this purpose.
Put your application-wide styles there.
2018-03-08 13:09:40 +08:00
大多数应用都会努力让整个应用保持一致的外观。
因此CLI 会生成一个空白的 `styles.css` 文件。
你可以把全应用级别的样式放进去。
2017-11-06 19:02:18 +01:00
Here's an excerpt from the `styles.css` for the _Tour of Heroes_ sample app.
2018-03-08 13:09:40 +08:00
下面是这个*英雄指南*范例应用中 `styles.css` 文件的片段。
<code-example path="toh-pt0/src/styles.1.css" header="src/styles.css (excerpt)">
2017-11-06 19:02:18 +01:00
</code-example>
## Final code review
2018-03-08 17:07:55 +08:00
## 查看最终代码
2018-03-08 13:09:40 +08:00
The source code for this tutorial and the complete _Tour of Heroes_ global styles
are available in the <live-example></live-example>.
2017-11-06 19:02:18 +01:00
2018-03-08 13:09:40 +08:00
本教程的源文件以及*英雄指南*的完整全局样式可以在 <live-example></live-example> 中看到。
Here are the code files discussed on this page.
2017-11-06 19:02:18 +01:00
2018-03-08 13:09:40 +08:00
下面是本页所提到的源代码:
2017-11-06 19:02:18 +01:00
<code-tabs>
<code-pane header="src/app/app.component.ts" path="toh-pt0/src/app/app.component.ts">
2017-11-06 19:02:18 +01:00
</code-pane>
<code-pane header="src/app/app.component.html" path="toh-pt0/src/app/app.component.html">
2017-11-06 19:02:18 +01:00
</code-pane>
<code-pane
header="src/styles.css (excerpt)"
2017-11-06 19:02:18 +01:00
path="toh-pt0/src/styles.1.css">
</code-pane>
</code-tabs>
## Summary
2018-03-03 21:06:01 +08:00
## 小结
2017-11-06 19:02:18 +01:00
* You created the initial application structure using the Angular CLI.
2018-03-03 21:06:01 +08:00
2018-03-24 13:12:42 +08:00
你使用 Angular CLI 创建了初始的应用结构。
2018-03-08 13:09:40 +08:00
2017-11-06 19:02:18 +01:00
* You learned that Angular components display data.
2018-03-03 21:06:01 +08:00
2018-03-24 13:12:42 +08:00
你学会了使用 Angular 组件来显示数据。
2018-03-08 13:09:40 +08:00
2018-03-24 16:33:17 +08:00
* You used the double curly braces of interpolation to display the app title.
2018-03-08 13:09:40 +08:00
2018-03-24 16:33:17 +08:00
你使用双花括号插值表达式显示了应用标题。