docs(aio): remove docs that are unwanted or in the wrong place
This commit is contained in:
parent
2d14c3b17a
commit
0fe308c0ef
|
@ -1,939 +0,0 @@
|
|||
@description
|
||||
Good tools make application development quicker and easier to maintain than
|
||||
if you did everything by hand.
|
||||
|
||||
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
|
||||
as testing, bundling, and deployment.
|
||||
|
||||
The goal in this guide is to build and run a simple Angular
|
||||
application in TypeScript, using the Angular CLI
|
||||
while adhering to the [Style Guide](guide/style-guide) recommendations that
|
||||
benefit _every_ Angular project.
|
||||
|
||||
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.
|
||||
|
||||
You'll pursue these ends in the following high-level steps:
|
||||
|
||||
1. [Set up](cli-quickstart#devenv) the development environment.
|
||||
2. [Create](cli-quickstart#create-proj) a new project and skeleton application.
|
||||
3. [Serve](cli-quickstart#serve) the application.
|
||||
4. [Edit](cli-quickstart#first-component) the application.
|
||||
|
||||
And you can also <a href="/resources/zips/cli-quickstart/cli-quickstart.zip">download the example.</a>
|
||||
|
||||
|
||||
|
||||
<h2 id='devenv'>
|
||||
Step 1. Set up the Development Environment
|
||||
</h2>
|
||||
|
||||
You need to set up your development environment before you can do anything.
|
||||
|
||||
Install **[Node.js® and npm](https://nodejs.org/en/download/)**
|
||||
if they are not already on your machine.
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
**Verify that you are running at least node `6.9.x` and npm `3.x.x`**
|
||||
by running `node -v` and `npm -v` in a terminal/console window.
|
||||
Older versions produce errors, but newer versions are fine.
|
||||
|
||||
~~~
|
||||
|
||||
Then **install the [Angular CLI](https://github.com/angular/angular-cli)** globally.
|
||||
|
||||
|
||||
<code-example language="sh" class="code-shell">
|
||||
npm install -g @angular/cli
|
||||
|
||||
</code-example>
|
||||
|
||||
|
||||
|
||||
|
||||
<h2 id='create-project'>
|
||||
Step 2. Create a new project
|
||||
</h2>
|
||||
|
||||
Open a terminal window.
|
||||
Generate a new project and skeleton application by running the following commands:
|
||||
|
||||
|
||||
<code-example language="sh" class="code-shell">
|
||||
ng new my-app
|
||||
|
||||
</code-example>
|
||||
|
||||
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
Patience please.
|
||||
It takes time to set up a new project, most of it spent installing npm packages.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
|
||||
<h2 id='serve'>
|
||||
Step 3: Serve the application
|
||||
</h2>
|
||||
|
||||
Go to the project directory and launch the server.
|
||||
|
||||
|
||||
<code-example language="sh" class="code-shell">
|
||||
cd my-app
|
||||
ng serve --open
|
||||
|
||||
</code-example>
|
||||
|
||||
The `ng serve` command launches the server, watches your files,
|
||||
and rebuilds the app as you make changes to those files.
|
||||
|
||||
Using the `--open` (or just `-o`) option will automatically open your browser
|
||||
on `http://localhost:4200/`.
|
||||
|
||||
Your app greets you with a message:
|
||||
|
||||
|
||||
<figure class='image-display'>
|
||||
<img src='assets/images/devguide/cli-quickstart/app-works.png' alt="The app works!"> </img>
|
||||
</figure>
|
||||
|
||||
|
||||
|
||||
|
||||
<h2 id='first-component'>
|
||||
Step 4: Edit your first Angular component
|
||||
</h2>
|
||||
|
||||
The CLI created the first Angular component for you.
|
||||
This is the _root component_ and it is named `app-root`.
|
||||
You can find it in `./src/app/app.component.ts`.
|
||||
Open the component file and change the `title` property from _app works!_ to _My First Angular App_:
|
||||
|
||||
|
||||
|
||||
<code-example path="cli-quickstart/src/app/app.component.ts" region="title" linenums="false">
|
||||
|
||||
</code-example>
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
<code-example path="cli-quickstart/src/app/app.component.css" linenums="false">
|
||||
|
||||
</code-example>
|
||||
|
||||
|
||||
|
||||
<figure class='image-display'>
|
||||
<img src='assets/images/devguide/cli-quickstart/my-first-app.png' alt="Output of QuickStart app"> </img>
|
||||
</figure>
|
||||
|
||||
Looking good!
|
||||
|
||||
## What's next?
|
||||
That's about all you'd expect to do in a "Hello, World" app.
|
||||
|
||||
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.
|
||||
|
||||
Or you can stick around a bit longer to learn about the files in your brand new project.
|
||||
|
||||
## Project file review
|
||||
|
||||
An Angular CLI project is the foundation for both quick experiments and enterprise solutions.
|
||||
|
||||
The first file you should check out is `README.md`.
|
||||
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
|
||||
[the Angular CLI repository](https://github.com/angular/angular-cli) and
|
||||
[Wiki](https://github.com/angular/angular-cli/wiki).
|
||||
|
||||
Some of the generated files might be unfamiliar to you.
|
||||
|
||||
### The `src` folder
|
||||
Your app lives in the `src` folder.
|
||||
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.
|
||||
|
||||
|
||||
<aio-filetree>
|
||||
|
||||
|
||||
<aio-folder>
|
||||
src
|
||||
|
||||
<aio-folder>
|
||||
app
|
||||
|
||||
<aio-file>
|
||||
app.component.css
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
app.component.html
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
app.component.spec.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
app.component.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
app.module.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
</aio-folder>
|
||||
|
||||
|
||||
|
||||
<aio-folder>
|
||||
assets
|
||||
|
||||
<aio-file>
|
||||
.gitkeep
|
||||
</aio-file>
|
||||
|
||||
|
||||
</aio-folder>
|
||||
|
||||
|
||||
|
||||
<aio-folder>
|
||||
environments
|
||||
|
||||
<aio-file>
|
||||
environment.prod.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
environment.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
</aio-folder>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
favicon.ico
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
index.html
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
main.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
polyfills.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
styles.css
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
test.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
tsconfig.app.json
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
tsconfig.spec.json
|
||||
</aio-file>
|
||||
|
||||
|
||||
</aio-folder>
|
||||
|
||||
|
||||
</aio-filetree>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
td, th {vertical-align: top}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<table width="100%">
|
||||
|
||||
|
||||
<col width="20%">
|
||||
|
||||
</col>
|
||||
|
||||
|
||||
|
||||
<col width="80%">
|
||||
|
||||
</col>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<th>
|
||||
File
|
||||
</th>
|
||||
|
||||
|
||||
|
||||
<th>
|
||||
Purpose
|
||||
</th>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>app/app.component.{ts,html,css,spec.ts}</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Defines the `AppComponent` along with an HTML template, CSS stylesheet, and a unit test.
|
||||
It is the **root** component of what will become a tree of nested components
|
||||
as the application evolves.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>app/app.module.ts</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Defines `AppModule`, the [root module](guide/appmodule) that tells Angular how to assemble the application.
|
||||
Right now it declares only the `AppComponent`.
|
||||
Soon there will be more components to declare.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>assets/*</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
A folder where you can put images and anything else to be copied wholesale
|
||||
when you build your application.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>environments/*</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
This folder contains one file for each of your destination environments,
|
||||
each exporting simple configuration variables to use in your application.
|
||||
The files are replaced on-the-fly when you build your app.
|
||||
You might use a different API endpoint for development than you do for production
|
||||
or maybe different analytics tokens.
|
||||
You might even use some mock services.
|
||||
Either way, the CLI has you covered.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>favicon.ico</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Every site wants to look good on the bookmark bar.
|
||||
Get started with your very own Angular icon.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>index.html</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
The main HTML page that is served when someone visits your site.
|
||||
Most of the time you'll never need to edit it.
|
||||
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.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>main.ts</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
The main entry point for your app.
|
||||
Compiles the application with the [JIT compiler](glossary)
|
||||
and bootstraps the application's root module (`AppModule`) to run in the browser.
|
||||
You can also use the [AOT compiler](glossary)
|
||||
without changing any code by passing in `--aot` to `ng build` or `ng serve`.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>polyfills.ts</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Different browsers have different levels of support of the web standards.
|
||||
Polyfills help normalize those differences.
|
||||
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.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>styles.css</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Your global styles go here.
|
||||
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.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>test.ts</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
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
|
||||
need to edit.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>tsconfig.{app|spec}.json</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
TypeScript compiler configuration for the Angular app (`tsconfig.app.json`)
|
||||
and for the unit tests (`tsconfig.spec.json`).
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
### The 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.
|
||||
These files go in the root folder next to `src/`.
|
||||
|
||||
|
||||
<aio-filetree>
|
||||
|
||||
|
||||
<aio-folder>
|
||||
my-app
|
||||
|
||||
<aio-folder>
|
||||
e2e
|
||||
|
||||
<aio-file>
|
||||
app.e2e-spec.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
app.po.ts
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
tsconfig.e2e.json
|
||||
</aio-file>
|
||||
|
||||
|
||||
</aio-folder>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
node_modules/...
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
src/...
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
.angular-cli.json
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
.editorconfig
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
.gitignore
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
karma.conf.js
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
package.json
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
protractor.conf.js
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
README.md
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
tsconfig.json
|
||||
</aio-file>
|
||||
|
||||
|
||||
|
||||
<aio-file>
|
||||
tslint.json
|
||||
</aio-file>
|
||||
|
||||
|
||||
</aio-folder>
|
||||
|
||||
|
||||
</aio-filetree>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
td, th {vertical-align: top}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<table width="100%">
|
||||
|
||||
|
||||
<col width="20%">
|
||||
|
||||
</col>
|
||||
|
||||
|
||||
|
||||
<col width="80%">
|
||||
|
||||
</col>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<th>
|
||||
File
|
||||
</th>
|
||||
|
||||
|
||||
|
||||
<th>
|
||||
Purpose
|
||||
</th>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>e2e/</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Inside `e2e/` live the End-to-End tests.
|
||||
They shouldn't be inside `src/` because e2e tests are really a separate app that
|
||||
just so happens to test your main app.
|
||||
That's also why they have their own `tsconfig.e2e.json`.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>node_modules/</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
`Node.js` creates this folder and puts all third party modules listed in
|
||||
`package.json` inside of it.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>.angular-cli.json</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Configuration for Angular CLI.
|
||||
In this file you can set several defaults and also configure what files are included
|
||||
when your project is build.
|
||||
Check out the official documentation if you want to know more.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>.editorconfig</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Simple configuration for your editor to make sure everyone that uses your project
|
||||
has the same basic configuration.
|
||||
Most editors support an `.editorconfig` file.
|
||||
See http://editorconfig.org for more information.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>.gitignore</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Git configuration to make sure autogenerated files are not commited to source control.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>karma.conf.js</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Unit test configuration for the [Karma test runner](https://karma-runner.github.io),
|
||||
used when running `ng test`.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>package.json</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
`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.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>protractor.conf.js</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
End-to-end test configuration for [Protractor](http://www.protractortest.org/),
|
||||
used when running `ng e2e`.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>README.md</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Basic documentation for your project, pre-filled with CLI command information.
|
||||
Make sure to enhance it with project documentation so that anyone
|
||||
checking out the repo can build your app!
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>tsconfig.json</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
TypeScript compiler configuration for your IDE to pick up and give you helpful tooling.
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<code>tslint.json</code>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
Linting configuration for [TSLint](https://palantir.github.io/tslint/) together with
|
||||
[Codelyzer](http://codelyzer.com/), used when running `ng lint`.
|
||||
Linting helps keep your code style consistent.
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
### Next Step
|
||||
|
||||
If you're new to Angular, continue on the
|
||||
[learning path](guide/learning-angular).
|
||||
You can skip the "Setup" step since you're already using the Angular CLI setup.
|
||||
|
||||
~~~
|
||||
|
|
@ -1,848 +0,0 @@
|
|||
@description
|
||||
|
||||
Angular has its own vocabulary.
|
||||
Most Angular terms are common English words
|
||||
with a specific meaning within the Angular system.
|
||||
|
||||
This glossary lists the most prominent terms
|
||||
and a few less familiar ones that have unusual or
|
||||
unexpected definitions.
|
||||
|
||||
[A](glossary#A) [B](glossary#B) [C](glossary#C) [D](glossary#D) [E](glossary#E) [F](glossary#F) [G](glossary#G) [H](glossary#H) [I](glossary#I)
|
||||
[J](glossary#J) [K](glossary#K) [L](glossary#L) [M](glossary#M) [N](glossary#N) [O](glossary#O) [P](glossary#P) [Q](glossary#Q) [R](glossary#R)
|
||||
[S](glossary#S) [T](glossary#T) [U](glossary#U) [V](glossary#V) [W](glossary#W) [X](glossary#X) [Y](glossary#Y) [Z](glossary#Z)
|
||||
|
||||
|
||||
|
||||
{@a aot}
|
||||
## Ahead-of-time (AOT) compilation
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
You can compile Angular applications at build time.
|
||||
By compiling your application<span if-docs="ts"> using the compiler-cli, `ngc`</span>, you can bootstrap directly
|
||||
to a<span if-docs="ts"> module</span> factory, meaning you don't need to include the Angular compiler in your JavaScript bundle.
|
||||
Ahead-of-time compiled applications also benefit from decreased load time and increased performance.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Annotation
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
In practice, a synonym for [Decoration](glossary#decorator).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a attribute-directive}
|
||||
|
||||
|
||||
{@a attribute-directives}
|
||||
## Attribute directives
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A category of [directive](glossary#directive) that can listen to and modify the behavior of
|
||||
other HTML elements, attributes, properties, and components. They are usually represented
|
||||
as HTML attributes, hence the name.
|
||||
|
||||
For example, you can use the `ngClass` directive to add and remove CSS class names.
|
||||
|
||||
Learn about them in the [_Attribute Directives_](!{docsLatest}/guide/attribute-directives) guide.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## Binding
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
Usually refers to [data binding](glossary#data-binding) and the act of
|
||||
binding an HTML object property to a data object property.
|
||||
|
||||
Sometimes refers to a [dependency-injection](glossary#dependency-injection) binding
|
||||
between a "token"—also referred to as a "key"—and a dependency [provider](glossary#provider).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Bootstrap
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
You launch an Angular application by "bootstrapping" it using the application root Angular module (`AppModule`).
|
||||
Bootstrapping identifies an application's top level "root" [component](glossary#component),
|
||||
which is the first component that is loaded for the application.
|
||||
For more information, see the [Setup](!{docsLatest}/guide/setup) page.
|
||||
|
||||
You can bootstrap multiple apps in the same `index.html`, each app with its own top-level root.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## camelCase
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
The practice of writing compound words or phrases such that each word or abbreviation begins with a capital letter
|
||||
_except the first letter, which is lowercase_.
|
||||
|
||||
Function, property, and method names are typically spelled in camelCase. For example, `square`, `firstName`, and `getHeroes`. Notice that `square` is an example of how you write a single word in camelCase.
|
||||
|
||||
camelCase is also known as *lower camel case* to distinguish it from *upper camel case*, or [PascalCase](glossary#pascalcase).
|
||||
In Angular documentation, "camelCase" always means *lower camel case*.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a component}
|
||||
## Component
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
An Angular class responsible for exposing data to a [view](glossary#view) and handling most of the view’s display and user-interaction logic.
|
||||
|
||||
The *component* is one of the most important building blocks in the Angular system.
|
||||
It is, in fact, an Angular [directive](glossary#directive) with a companion [template](glossary#template).
|
||||
|
||||
Apply the `!{_at}Component` !{_decoratorLink} to
|
||||
the component class, thereby attaching to the class the essential component metadata
|
||||
that Angular needs to create a component instance and render the component with its template
|
||||
as a view.
|
||||
|
||||
Those familiar with "MVC" and "MVVM" patterns will recognize
|
||||
the component in the role of "controller" or "view model".
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## dash-case
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
The practice of writing compound words or phrases such that each word is separated by a dash or hyphen (`-`).
|
||||
This form is also known as kebab-case.
|
||||
|
||||
[Directive](glossary#directive) selectors (like `my-app`) <span if-docs="ts">and
|
||||
the root of filenames (such as `hero-list.component.ts`)</span> are often
|
||||
spelled in dash-case.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Data binding
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
Applications display data values to a user and respond to user
|
||||
actions (such as clicks, touches, and keystrokes).
|
||||
|
||||
In data binding, you declare the relationship between an HTML widget and data source
|
||||
and let the framework handle the details.
|
||||
Data binding is an alternative to manually pushing application data values into HTML, attaching
|
||||
event listeners, pulling changed values from the screen, and
|
||||
updating application data values.
|
||||
|
||||
Angular has a rich data-binding framework with a variety of data-binding
|
||||
operations and supporting declaration syntax.
|
||||
|
||||
Read about the following forms of binding in the [Template Syntax](!{docsLatest}/guide/template-syntax) page:
|
||||
* [Interpolation](!{docsLatest}/guide/template-syntax).
|
||||
* [Property binding](!{docsLatest}/guide/template-syntax).
|
||||
* [Event binding](!{docsLatest}/guide/template-syntax).
|
||||
* [Attribute binding](!{docsLatest}/guide/template-syntax).
|
||||
* [Class binding](!{docsLatest}/guide/template-syntax).
|
||||
* [Style binding](!{docsLatest}/guide/template-syntax).
|
||||
* [Two-way data binding with ngModel](!{docsLatest}/guide/template-syntax).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a decorator}
|
||||
|
||||
|
||||
{@a decoration}
|
||||
## Decorator | decoration
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A *function* that adds metadata to a class, its members (properties, methods) and function arguments.
|
||||
|
||||
Decorators are a JavaScript language [feature](https://github.com/wycats/javascript-decorators), implemented in TypeScript and proposed for ES2016 (also known as ES7).
|
||||
|
||||
To apply a decorator, position it immediately above or to the left of the item it decorates.
|
||||
|
||||
Angular has its own set of decorators to help it interoperate with your application parts.
|
||||
The following example is a `@Component` decorator that identifies a
|
||||
class as an Angular [component](glossary#component) and an `@Input` decorator applied to the `name` property
|
||||
of that component. The elided object argument to the `@Component` decorator would contain the pertinent component metadata.
|
||||
```
|
||||
@Component({...})
|
||||
export class AppComponent {
|
||||
constructor(@Inject('SpecialFoo') public foo:Foo) {}
|
||||
@Input() name:string;
|
||||
}
|
||||
```
|
||||
The scope of a decorator is limited to the language feature
|
||||
that it decorates. None of the decorations shown here will "leak" to other
|
||||
classes that follow it in the file.
|
||||
|
||||
|
||||
~~~ {.alert.is-important}
|
||||
|
||||
Always include parentheses `()` when applying a decorator.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Dependency injection
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A design pattern and mechanism
|
||||
for creating and delivering parts of an application to other
|
||||
parts of an application that request them.
|
||||
|
||||
Angular developers prefer to build applications by defining many simple parts
|
||||
that each do one thing well and then wiring them together at runtime.
|
||||
|
||||
These parts often rely on other parts. An Angular [component](glossary#component)
|
||||
part might rely on a service part to get data or perform a calculation. When
|
||||
part "A" relies on another part "B," you say that "A" depends on "B" and
|
||||
that "B" is a dependency of "A."
|
||||
|
||||
You can ask a "dependency injection system" to create "A"
|
||||
for us and handle all the dependencies.
|
||||
If "A" needs "B" and "B" needs "C," the system resolves that chain of dependencies
|
||||
and returns a fully prepared instance of "A."
|
||||
|
||||
|
||||
Angular provides and relies upon its own sophisticated
|
||||
dependency-injection system
|
||||
to assemble and run applications by "injecting" application parts
|
||||
into other application parts where and when needed.
|
||||
|
||||
At the core, an [`injector`](glossary#injector) returns dependency values on request.
|
||||
The expression `injector.get(token)` returns the value associated with the given token.
|
||||
|
||||
A token is an Angular type (`OpaqueToken`). You rarely need to work with tokens directly; most
|
||||
methods accept a class name (`Foo`) or a string ("foo") and Angular converts it
|
||||
to a token. When you write `injector.get(Foo)`, the injector returns
|
||||
the value associated with the token for the `Foo` class, typically an instance of `Foo` itself.
|
||||
|
||||
During many of its operations, Angular makes similar requests internally, such as when it creates a [`component`](glossary#component) for display.
|
||||
|
||||
The `Injector` maintains an internal map of tokens to dependency values.
|
||||
If the `Injector` can't find a value for a given token, it creates
|
||||
a new value using a `Provider` for that token.
|
||||
|
||||
A [provider](glossary#provider) is a recipe for
|
||||
creating new instances of a dependency value associated with a particular token.
|
||||
|
||||
An injector can only create a value for a given token if it has
|
||||
a `provider` for that token in its internal provider registry.
|
||||
Registering providers is a critical preparatory step.
|
||||
|
||||
Angular registers some of its own providers with every injector.
|
||||
You can register your own providers.
|
||||
|
||||
Read more in the [Dependency Injection](!{docsLatest}/guide/dependency-injection) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a directive}
|
||||
|
||||
|
||||
{@a directives}
|
||||
## Directive
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
An Angular class responsible for creating, reshaping, and interacting with HTML elements
|
||||
in the browser DOM. The directive is Angular's most fundamental feature.
|
||||
|
||||
A directive is usually associated with an HTML element or attribute.
|
||||
This element or attribute is often referred to as the directive itself.
|
||||
|
||||
When Angular finds a directive in an HTML template,
|
||||
it creates the matching directive class instance
|
||||
and gives the instance control over that portion of the browser DOM.
|
||||
|
||||
You can invent custom HTML markup (for example, `<my-directive>`) to
|
||||
associate with your custom directives. You add this custom markup to HTML templates
|
||||
as if you were writing native HTML. In this way, directives become extensions of
|
||||
HTML itself.
|
||||
|
||||
Directives fall into one of the following categories:
|
||||
|
||||
* [Components](glossary#component) combine application logic with an HTML template to
|
||||
render application [views](glossary#view). Components are usually represented as HTML elements.
|
||||
They are the building blocks of an Angular application.
|
||||
|
||||
* [Attribute directives](glossary#attribute-directive) can listen to and modify the behavior of
|
||||
other HTML elements, attributes, properties, and components. They are usually represented
|
||||
as HTML attributes, hence the name.
|
||||
|
||||
* [Structural directives](glossary#structural-directive) are responsible for
|
||||
shaping or reshaping HTML layout, typically by adding, removing, or manipulating
|
||||
elements and their children.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## ECMAScript
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
The [official JavaScript language specification](https://en.wikipedia.org/wiki/ECMAScript).
|
||||
|
||||
The latest approved version of JavaScript is
|
||||
[ECMAScript 2016](http://www.ecma-international.org/ecma-262/7.0/)
|
||||
(also known as "ES2016" or "ES7"). Many Angular developers write their applications
|
||||
in ES7 or a dialect that strives to be
|
||||
compatible with it, such as [TypeScript](glossary#typescript).
|
||||
|
||||
Most modern browsers only support the much older "ECMAScript 5" (also known as "ES5") standard.
|
||||
Applications written in ES2016, ES2015, or one of their dialects must be [transpiled](glossary#transpile)
|
||||
to ES5 JavaScript.
|
||||
|
||||
Angular developers can write in ES5 directly.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## ES2015
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
Short hand for [ECMAScript](glossary#ecmascript) 2015.
|
||||
|
||||
~~~
|
||||
|
||||
## ES5
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
Short hand for [ECMAScript](glossary#ecmascript) 5, the version of JavaScript run by most modern browsers.
|
||||
|
||||
~~~
|
||||
|
||||
## ES6
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
Short hand for [ECMAScript](glossary#ecmascript) 2015.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a F}
|
||||
|
||||
|
||||
{@a G}
|
||||
|
||||
|
||||
{@a H}
|
||||
|
||||
## Injector
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
An object in the Angular [dependency-injection system](glossary#dependency-injection)
|
||||
that can find a named dependency in its cache or create a dependency
|
||||
with a registered [provider](glossary#provider).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Input
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A directive property that can be the *target* of a
|
||||
[property binding](!{docsLatest}/guide/template-syntax) (explained in detail in the [Template Syntax](!{docsLatest}/guide/template-syntax) page).
|
||||
Data values flow *into* this property from the data source identified
|
||||
in the template expression to the right of the equal sign.
|
||||
|
||||
See the [Input and output properties](!{docsLatest}/guide/template-syntax) section of the [Template Syntax](!{docsLatest}/guide/template-syntax) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Interpolation
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A form of [property data binding](glossary#data-binding) in which a
|
||||
[template expression](glossary#template-expression) between double-curly braces
|
||||
renders as text. That text may be concatenated with neighboring text
|
||||
before it is assigned to an element property
|
||||
or displayed between element tags, as in this example.
|
||||
|
||||
|
||||
<code-example language="html" escape="html">
|
||||
<label>My current hero is {{hero.name}}</label>
|
||||
|
||||
</code-example>
|
||||
|
||||
Read more about [interpolation](!{docsLatest}/guide/template-syntax) in the
|
||||
[Template Syntax](!{docsLatest}/guide/template-syntax) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
|
||||
{@a jit}
|
||||
## Just-in-time (JIT) compilation
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A bootstrapping method of compiling components<span if-docs="ts"> and modules</span> in the browser
|
||||
and launching the application dynamically. Just-in-time mode is a good choice during development.
|
||||
Consider using the [ahead-of-time](glossary#aot) mode for production apps.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## kebab-case
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
See [dash-case](glossary#dash-case).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## Lifecycle hooks
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
[Directives](glossary#directive) and [components](glossary#component) have a lifecycle
|
||||
managed by Angular as it creates, updates, and destroys them.
|
||||
|
||||
You can tap into key moments in that lifecycle by implementing
|
||||
one or more of the lifecycle hook interfaces.
|
||||
|
||||
Each interface has a single hook method whose name is the interface name prefixed with `ng`.
|
||||
For example, the `OnInit` interface has a hook method named `ngOnInit`.
|
||||
|
||||
Angular calls these hook methods in the following order:
|
||||
* `ngOnChanges`: when an [input](glossary#input)/[output](glossary#output) binding value changes.
|
||||
* `ngOnInit`: after the first `ngOnChanges`.
|
||||
* `ngDoCheck`: developer's custom change detection.
|
||||
* `ngAfterContentInit`: after component content initialized.
|
||||
* `ngAfterContentChecked`: after every check of component content.
|
||||
* `ngAfterViewInit`: after a component's views are initialized.
|
||||
* `ngAfterViewChecked`: after every check of a component's views.
|
||||
* `ngOnDestroy`: just before the directive is destroyed.
|
||||
|
||||
Read more in the [Lifecycle Hooks](!{docsLatest}/guide/lifecycle-hooks) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## Module
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
|
||||
|
||||
~~~ {.alert.is-important}
|
||||
|
||||
Angular has the following types of modules:
|
||||
- [Angular modules](glossary#angular-module).
|
||||
For details and examples, see the [Angular Modules](!{docsLatest}/guide/ngmodule) page.
|
||||
- ES2015 modules, as described in this section.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
A cohesive block of code dedicated to a single purpose.
|
||||
|
||||
Angular apps are modular.
|
||||
|
||||
In general, you assemble an application from many modules, both the ones you write and the ones you acquire from others.
|
||||
|
||||
A module *exports* something of value in that code, typically one thing such as a class;
|
||||
a module that needs that class *imports* it.
|
||||
|
||||
The structure of Angular modules and the import/export syntax
|
||||
is based on the [ES2015 module standard](http://www.2ality.com/2014/09/es6-modules-final.html).
|
||||
|
||||
An application that adheres to this standard requires a module loader to
|
||||
load modules on request and resolve inter-module dependencies.
|
||||
Angular doesn't include a module loader and doesn't have a preference
|
||||
for any particular third-party library (although most examples use SystemJS).
|
||||
You can use any module library that conforms to the standard.
|
||||
|
||||
Modules are typically named after the file in which the exported thing is defined.
|
||||
The Angular [DatePipe](https://github.com/angular/angular/blob/master/modules/@angular/common/src/pipes/date_pipe.ts)
|
||||
class belongs to a feature module named `date_pipe` in the file `date_pipe.ts`.
|
||||
|
||||
You rarely access Angular feature modules directly. You usually import them from an Angular [scoped package](glossary#scoped-package) such as `@angular/core`.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a N}
|
||||
|
||||
## Output
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A directive property that can be the *target* of event binding
|
||||
(read more in the [event binding](!{docsLatest}/guide/template-syntax)
|
||||
section of the [Template Syntax](!{docsLatest}/guide/template-syntax) page).
|
||||
Events stream *out* of this property to the receiver identified
|
||||
in the template expression to the right of the equal sign.
|
||||
|
||||
See the [Input and output properties](!{docsLatest}/guide/template-syntax) section of the [Template Syntax](!{docsLatest}/guide/template-syntax) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## PascalCase
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
The practice of writing individual words, compound words, or phrases such that each word or abbreviation begins with a capital letter.
|
||||
Class names are typically spelled in PascalCase. For example, `Person` and `HeroDetailComponent`.
|
||||
|
||||
This form is also known as *upper camel case* to distinguish it from *lower camel case* or simply [camelCase](glossary#camelcase).
|
||||
In this documentation, "PascalCase" means *upper camel case* and "camelCase" means *lower camel case*.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Pipe
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
An Angular pipe is a function that transforms input values to output values for
|
||||
display in a [view](glossary#view).
|
||||
Here's an example that uses the built-in `currency` pipe to display
|
||||
a numeric value in the local currency.
|
||||
|
||||
|
||||
<code-example language="html" escape="html">
|
||||
<label>Price: </label>{{product.price | currency}}
|
||||
|
||||
</code-example>
|
||||
|
||||
You can also write your own custom pipes.
|
||||
Read more in the page on [pipes](!{docsLatest}/guide/pipes).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Provider
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A _provider_ creates a new instance of a dependency for the
|
||||
[dependency injection](glossary#dependency-injection) system.
|
||||
It relates a lookup token to code—sometimes called a "recipe"—that can create a dependency value.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a Q}
|
||||
|
||||
## Reactive forms
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A technique for building Angular forms through code in a component.
|
||||
The alternative technique is [template-driven forms](glossary#template-driven-forms).
|
||||
|
||||
When building reactive forms:
|
||||
- The "source of truth" is the component. The validation is defined using code in the component.
|
||||
- Each control is explicitly created in the component class with `new FormControl()` or with `FormBuilder`.
|
||||
- The template input elements do *not* use `ngModel`.
|
||||
- The associated Angular directives are all prefixed with `Form`, such as `FormGroup`, `FormControl`, and `FormControlName`.
|
||||
|
||||
Reactive forms are powerful, flexible, and a good choice for more complex data-entry form scenarios, such as dynamic generation of form controls.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Router
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
Most applications consist of many screens or [views](glossary#view).
|
||||
The user navigates among them by clicking links and buttons,
|
||||
and performing other similar actions that cause the application to
|
||||
replace one view with another.
|
||||
|
||||
The Angular component router is a richly featured mechanism for configuring and managing the entire view navigation process, including the creation and destruction
|
||||
of views.
|
||||
|
||||
~~~
|
||||
|
||||
## Router module
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A separate [Angular module](glossary#angular-module) that provides the necessary service providers and directives for navigating through application views.
|
||||
|
||||
For more information, see the [Routing & Navigation](!{docsLatest}/guide/router) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Routing component
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
An Angular [component](glossary#component) with a `RouterOutlet` that displays views based on router navigations.
|
||||
|
||||
For more information, see the [Routing & Navigation](!{docsLatest}/guide/router) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## Scoped package
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A way to group related *npm* packages.
|
||||
Read more at the [npm-scope](https://docs.npmjs.com/misc/scope) page.
|
||||
|
||||
Angular modules are delivered within *scoped packages* such as `@angular/core`,
|
||||
`@angular/common`, `@angular/platform-browser-dynamic`, `@angular/http`, and `@angular/router`.
|
||||
|
||||
Import a scoped package the same way that you import a normal package.
|
||||
The only difference, from a consumer perspective,
|
||||
is that the scoped package name begins with the Angular *scope name*, `@angular`.
|
||||
|
||||
|
||||
|
||||
<code-example path="architecture/src/app/app.component.ts" linenums="false" title="architecture/ts/src/app/app.component.ts (import)" region="import">
|
||||
|
||||
</code-example>
|
||||
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Service
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
For data or logic that is not associated
|
||||
with a specific view or that you want to share across components, build services.
|
||||
|
||||
Applications often require services such as a hero data service or a logging service.
|
||||
|
||||
A service is a class with a focused purpose.
|
||||
You often create a service to implement features that are
|
||||
independent from any specific view,
|
||||
provide shared data or logic across components, or encapsulate external interactions.
|
||||
|
||||
Applications often require services such as a data service or a logging service.
|
||||
|
||||
For more information, see the [Services](!{docsLatest}/tutorial/toh-pt4) page of the [Tour of Heroes](!{docsLatest}/tutorial/) tutorial.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a snake-case}
|
||||
## snake_case
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
The practice of writing compound words or phrases such that an
|
||||
underscore (`_`) separates one word from the next. This form is also known as *underscore case*.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a structural-directive}
|
||||
|
||||
|
||||
{@a structural-directives}
|
||||
## Structural directives
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A category of [directive](glossary#directive) that can
|
||||
shape or reshape HTML layout, typically by adding and removing elements in the DOM.
|
||||
The `ngIf` "conditional element" directive and the `ngFor` "repeater" directive are well-known examples.
|
||||
|
||||
Read more in the [Structural Directives](!{docsLatest}/guide/structural-directives) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
## Template
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A chunk of HTML that Angular uses to render a [view](glossary#view) with
|
||||
the support and guidance of an Angular [directive](glossary#directive),
|
||||
most notably a [component](glossary#component).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Template-driven forms
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A technique for building Angular forms using HTML forms and input elements in the view.
|
||||
The alternate technique is [Reactive Forms](glossary#reactive-forms).
|
||||
|
||||
When building template-driven forms:
|
||||
- The "source of truth" is the template. The validation is defined using attributes on the individual input elements.
|
||||
- [Two-way binding](glossary#data-binding) with `ngModel` keeps the component model synchronized with the user's entry into the input elements.
|
||||
- Behind the scenes, Angular creates a new control for each input element, provided you have set up a `name` attribute and two-way binding for each input.
|
||||
- The associated Angular directives are all prefixed with `ng` such as `ngForm`, `ngModel`, and `ngModelGroup`.
|
||||
|
||||
Template-driven forms are convenient, quick, and simple. They are a good choice for many basic data-entry form scenarios.
|
||||
|
||||
Read about how to build template-driven forms
|
||||
in the [Forms](!{docsLatest}/guide/forms) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Template expression
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A !{_Lang}-like syntax that Angular evaluates within
|
||||
a [data binding](glossary#data-binding).
|
||||
|
||||
Read about how to write template expressions
|
||||
in the [Template expressions](!{docsLatest}/guide/template-syntax) section
|
||||
of the [Template Syntax](!{docsLatest}/guide/template-syntax) page.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## Transpile
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
The process of transforming code written in one form of JavaScript
|
||||
(such as TypeScript) into another form of JavaScript (such as [ES5](glossary#es5)).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## TypeScript
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A version of JavaScript that supports most [ECMAScript 2015](glossary#es2015)
|
||||
language features such as [decorators](glossary#decorator).
|
||||
|
||||
TypeScript is also notable for its optional typing system, which provides
|
||||
compile-time type checking and strong tooling support (such as "intellisense,"
|
||||
code completion, refactoring, and intelligent search). Many code editors
|
||||
and IDEs support TypeScript either natively or with plugins.
|
||||
|
||||
TypeScript is the preferred language for Angular development, although
|
||||
you can use other JavaScript dialects such as [ES5](glossary#es5).
|
||||
|
||||
Read more about TypeScript at [typescriptlang.org](http://www.typescriptlang.org/).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a U}
|
||||
|
||||
## View
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A portion of the screen that displays information and responds
|
||||
to user actions such as clicks, mouse moves, and keystrokes.
|
||||
|
||||
Angular renders a view under the control of one or more [directives](glossary#directive),
|
||||
especially [component](glossary#component) directives and their companion [templates](glossary#template).
|
||||
The component plays such a prominent role that it's often
|
||||
convenient to refer to a component as a view.
|
||||
|
||||
Views often contain other views. Any view might be loaded and unloaded
|
||||
dynamically as the user navigates through the application, typically
|
||||
under the control of a [router](glossary#router).
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
{@a W}
|
||||
|
||||
|
||||
{@a X}
|
||||
|
||||
|
||||
{@a Y}
|
||||
|
||||
## Zone
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
A mechanism for encapsulating and intercepting
|
||||
a JavaScript application's asynchronous activity.
|
||||
|
||||
The browser DOM and JavaScript have a limited number
|
||||
of asynchronous activities, such as DOM events (for example, clicks),
|
||||
[promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), and
|
||||
[XHR](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)
|
||||
calls to remote servers.
|
||||
|
||||
Zones intercept all of these activities and give a "zone client" the opportunity
|
||||
to take action before and after the async activity finishes.
|
||||
|
||||
Angular runs your application in a zone where it can respond to
|
||||
asynchronous events by checking for data changes and updating
|
||||
the information it displays via [data bindings](glossary#data-binding).
|
||||
|
||||
Learn more about zones in this
|
||||
[Brian Ford video](https://www.youtube.com/watch?v=3IqtmUscE_U).
|
||||
|
||||
~~~
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
@description
|
||||
|
||||
|
||||
<div flex=true>
|
||||
|
||||
|
||||
<p>
|
||||
What's your question about?
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<select id='feedback-dropdown' name="Angular Version">
|
||||
|
||||
|
||||
<option value="Angular">
|
||||
Angular
|
||||
</option>
|
||||
|
||||
|
||||
|
||||
<option value="AngularJS">
|
||||
AngularJS
|
||||
</option>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<button id='feedback-btn'>
|
||||
Submit
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
@ -1 +0,0 @@
|
|||
@description
|
|
@ -1,217 +0,0 @@
|
|||
@description
|
||||
|
||||
|
||||
<div class='clearfix'>
|
||||
<a class='card' class='c4' href="/docs/#{lang}/#{vers}/quickstart.html">
|
||||
|
||||
<h2 class='text-headline' class='text-uppercase'>
|
||||
Quickstart
|
||||
</h2>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
A short beginner guide explaining the basic concepts of Angular
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<footer>
|
||||
View Quickstart
|
||||
</footer>
|
||||
|
||||
</a> <a class='card' class='c4' href="/docs/#{lang}/#{vers}/guide/">
|
||||
|
||||
<h2 class='text-headline' class='text-uppercase'>
|
||||
Developer Guide
|
||||
</h2>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
An intermediate development guide covering all major features of Angular
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<footer>
|
||||
View Guide
|
||||
</footer>
|
||||
|
||||
</a> <a class='card' class='c4' href="/docs/#{lang}/#{vers}/api/">
|
||||
|
||||
<h2 class='text-headline' class='text-uppercase'>
|
||||
API Reference
|
||||
</h2>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
An advanced reference of all Angular Classes, Methods, etc.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<footer>
|
||||
View API
|
||||
</footer>
|
||||
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class='c4' class='secondary-content-list'>
|
||||
|
||||
|
||||
<h4>
|
||||
Advanced Documentation
|
||||
</h4>
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/guide/animations.html"> Animations </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/guide/attribute-directives.html"> Attribute Directives </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/guide/browser-support.html"> Browser Support </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/guide/component-styles.html"> Component Styles </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/guide/deployment.html"> Deployment </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/guide/animations.html"> View All... </a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class='c4' class='secondary-content-list'>
|
||||
|
||||
|
||||
<h4>
|
||||
Cookbook
|
||||
</h4>
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/cookbook/aot-compiler.html"> Ahead-of-time Compilation </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/cookbook/ajs-quick-reference.html"> AngularJS to Angular </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/cookbook/component-communication.html"> Component Interaction </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/cookbook/dependency-injection.html"> Dependency Injection </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="/docs/#{lang}/#{vers}/cookbook/"> View All... </a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class='c4' class='secondary-content-list'>
|
||||
|
||||
|
||||
<h4>
|
||||
Tools & Libraries
|
||||
</h4>
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
|
||||
|
||||
<li>
|
||||
<a target="_blank" href="https://github.com/angular/universal"> Angular Universal </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a target="_blank" href="https://augury.angular.io/"> Augury </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a target="_blank" href="https://github.com/jaxio/celerio-angular-quickstart"> Celerio Angular Quickstart </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a target="_blank" href="https://github.com/mgechev/codelyzer"> Codelyzer </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a target="_blank" href="https://github.com/johnpapa/lite-server"> Lite-server </a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a target="_blank" href="/resources/"> View All... </a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
@description
|
||||
|
||||
Angular applications are made up of _components_.
|
||||
A _component_ is the combination of an HTML template and a component class that controls a portion of the screen. Here is an example of a component that displays a simple string:
|
||||
|
||||
|
||||
|
||||
<code-example path="quickstart/src/app/app.component.ts" linenums="false">
|
||||
|
||||
</code-example>
|
||||
|
||||
|
||||
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
Try this **<live-example noDownload>QuickStart example on Plunker</live-example>** without installing anything.
|
||||
Try it locally with the [***QuickStart seed***](guide/setup)
|
||||
and prepare for development of a real Angular application.
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
Every component begins with an `@Component` [!{_decorator}](glossary)
|
||||
<span if-docs="ts">function</span> that
|
||||
<span if-docs="ts">takes a _metadata_ object. The metadata object</span> describes how the HTML template and component class work together.
|
||||
|
||||
The `selector` property tells Angular to display the component inside a custom `<my-app>` tag in the `index.html`.
|
||||
|
||||
|
||||
<code-example path="quickstart/src/index.html" region="my-app" linenums="false">
|
||||
|
||||
</code-example>
|
||||
|
||||
The `template` property defines a message inside an `<h1>` header.
|
||||
The message starts with "Hello" and ends with `{{name}}`,
|
||||
which is an Angular [interpolation binding](guide/displaying-data) expression.
|
||||
At runtime, Angular replaces `{{name}}` with the value of the component's `name` property.
|
||||
Interpolation binding is one of many Angular features you'll discover in this documentation.
|
||||
|
||||
|
||||
~~~ {.l-sub-section}
|
||||
|
||||
### Next step
|
||||
|
||||
Start [**learning Angular**](guide/learning-angular).
|
||||
|
||||
~~~
|
||||
|
|
@ -1 +0,0 @@
|
|||
@description
|
Loading…
Reference in New Issue