parent
bc804322c4
commit
4d46d7c1e4
@ -28,21 +28,20 @@ block includes
|
|||||||
+ifDocsFor('ts')
|
+ifDocsFor('ts')
|
||||||
a#aot
|
a#aot
|
||||||
:marked
|
:marked
|
||||||
## Ahead of Time (AOT) Compilation
|
## Ahead-of-time (AoT) compilation
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
You can compile Angular applications at build-time.
|
You can compile Angular applications at build-time.
|
||||||
By compiling your application using the compiler-cli, `ngc`, you can bootstrap directly
|
By compiling your application using the compiler-cli, `ngc`, you can bootstrap directly
|
||||||
to a Module Factory, meaning you don't need to include the Angular compiler in your Javascript bundle.
|
to a module 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.
|
Ahead-of-time compiled applications also benefit from decreased load time and increased performance.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Angular Module
|
## Angular module
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
Helps us organize an application into cohesive blocks of functionality.
|
Helps you organize an application into cohesive blocks of functionality.
|
||||||
An Angular module identifies the components, directives, and pipes that the application uses
|
An Angular module identifies the components, directives, and pipes that the application uses along with the list of external Angular modules that the application needs, such as `FormsModule`.
|
||||||
along with the list of external Angular modules that the application needs, such as `FormsModule`.
|
|
||||||
|
|
||||||
Every Angular application has an application root module class. By convention, the class is
|
Every Angular application has an application root module class. By convention, the class is
|
||||||
called `AppModule` and resides in a file named `app.component.ts`.
|
called `AppModule` and resides in a file named `app.component.ts`.
|
||||||
@ -58,14 +57,14 @@ block includes
|
|||||||
In practice, a synonym for [Decoration](#decorator).
|
In practice, a synonym for [Decoration](#decorator).
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Attribute Directive
|
## Attribute directive
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A category of [Directive](#directive) that can listen to and modify the behavior of
|
A category of [directive](#directive) that can listen to and modify the behavior of
|
||||||
other HTML elements, attributes, properties, and components. They are usually represented
|
other HTML elements, attributes, properties, and components. They are usually represented
|
||||||
as HTML attributes, hence the name.
|
as HTML attributes, hence the name.
|
||||||
|
|
||||||
A good example of an Attribute Directive is the `ngClass` directive for adding and removing CSS class names.
|
A good example of an attribute directive is the `ngClass` directive for adding and removing CSS class names.
|
||||||
|
|
||||||
.l-main-section#B
|
.l-main-section#B
|
||||||
|
|
||||||
@ -100,7 +99,7 @@ block includes
|
|||||||
export * from './hero.service.ts'; // re-export all of its exports
|
export * from './hero.service.ts'; // re-export all of its exports
|
||||||
export { HeroComponent } from './hero.component.ts'; // re-export the named thing
|
export { HeroComponent } from './hero.component.ts'; // re-export the named thing
|
||||||
:marked
|
:marked
|
||||||
Now a consumer can import what they need from the barrel.
|
Now a consumer can import what it needs from the barrel.
|
||||||
code-example.
|
code-example.
|
||||||
import { Hero, HeroService } from '../heroes'; // index is implied
|
import { Hero, HeroService } from '../heroes'; // index is implied
|
||||||
:marked
|
:marked
|
||||||
@ -121,7 +120,7 @@ block includes
|
|||||||
Almost always refers to [Data Binding](#data-binding) and the act of
|
Almost always refers to [Data Binding](#data-binding) and the act of
|
||||||
binding an HTML object property to a data object property.
|
binding an HTML object property to a data object property.
|
||||||
|
|
||||||
May refer to a [Dependency Injection](#dependency-injection) binding
|
May refer to a [dependency injection](#dependency-injection) binding
|
||||||
between a "token", also referred to as a "key", and a dependency [provider](#provider).
|
between a "token", also referred to as a "key", and a dependency [provider](#provider).
|
||||||
This more rare usage should be clear in context.
|
This more rare usage should be clear in context.
|
||||||
|
|
||||||
@ -130,9 +129,7 @@ block includes
|
|||||||
.l-sub-section
|
.l-sub-section
|
||||||
block bootstrap-defn-top
|
block bootstrap-defn-top
|
||||||
:marked
|
:marked
|
||||||
You launch an Angular application by "bootstrapping" it using the application root Angular module (`AppModule`).
|
You launch an Angular application by "bootstrapping" it using the application root Angular module (`AppModule`). Bootstrapping identifies an application's top level "root" [component](#component), which is the first component that is loaded for the application. For more information, see [QuickStart](!{docsLatest}/quickstart.html).
|
||||||
Bootstrapping identifies an application's top level "root" [Component](#component), which is the first
|
|
||||||
component that is loaded for the application. For more information, see [QuickStart](!{docsLatest}/quickstart.html).
|
|
||||||
:marked
|
:marked
|
||||||
You can bootstrap multiple apps in the same `index.html`, each with its own top level root.
|
You can bootstrap multiple apps in the same `index.html`, each with its own top level root.
|
||||||
|
|
||||||
@ -142,23 +139,21 @@ block includes
|
|||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
The practice of writing compound words or phrases such that each word or abbreviation begins with a capital letter
|
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_.
|
_except the first letter, which is lowercase_.
|
||||||
|
|
||||||
Function, property, and method names are typically spelled in camelCase. Examples include: `square`, `firstName` and `getHeroes`. Notice that `square` is an example of how you write a single word in camelCase.
|
Function, property, and method names are typically spelled in camelCase. Examples include: `square`, `firstName` and `getHeroes`. Notice that `square` is an example of how you write a single word in camelCase.
|
||||||
|
|
||||||
This form is also known as **lower camel case**, to distinguish it from **upper camel case** which is [PascalCase](#pascalcase).
|
This form is also known as **lower camel case**, to distinguish it from **upper camel case**, which is [PascalCase](#pascalcase).
|
||||||
When you see "camelCase" in this documentation it always means *lower camel case*.
|
When you see "camelCase" in this documentation it always means *lower camel case*.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Component
|
## Component
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
An Angular class responsible for exposing data
|
An Angular class responsible for exposing data to a [view](#view) and handling most of the view’s display and user-interaction logic.
|
||||||
to a [View](#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.
|
The *component* is one of the most important building blocks in the Angular system.
|
||||||
It is, in fact, an Angular [Directive](#directive) with a companion [Template](#template).
|
It is, in fact, an Angular [directive](#directive) with a companion [template](#template).
|
||||||
|
|
||||||
You apply the `!{_at}Component` !{_decoratorLink} to
|
You apply the `!{_at}Component` !{_decoratorLink} to
|
||||||
the component class, thereby attaching to the class the essential component metadata
|
the component class, thereby attaching to the class the essential component metadata
|
||||||
@ -166,7 +161,7 @@ block includes
|
|||||||
as a view.
|
as a view.
|
||||||
|
|
||||||
Those familiar with "MVC" and "MVVM" patterns will recognize
|
Those familiar with "MVC" and "MVVM" patterns will recognize
|
||||||
the Component in the role of "Controller" or "View Model".
|
the component in the role of "controller" or "view model".
|
||||||
|
|
||||||
.l-main-section#D
|
.l-main-section#D
|
||||||
:marked
|
:marked
|
||||||
@ -181,7 +176,7 @@ block includes
|
|||||||
spelled in dash-case.
|
spelled in dash-case.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Data Binding
|
## Data binding
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
Applications display data values to a user and respond to user
|
Applications display data values to a user and respond to user
|
||||||
@ -195,27 +190,25 @@ block includes
|
|||||||
Angular has a rich data binding framework with a variety of data binding
|
Angular has a rich data binding framework with a variety of data binding
|
||||||
operations and supporting declaration syntax.
|
operations and supporting declaration syntax.
|
||||||
|
|
||||||
The many forms of binding include:
|
Read about the forms of binding in the [Template Syntax](!{docsLatest}/guide/template-syntax.html#data-binding) page:
|
||||||
* [Interpolation](!{docsLatest}/guide/template-syntax.html#interpolation).
|
* [Interpolation](!{docsLatest}/guide/template-syntax.html#interpolation).
|
||||||
* [Property Binding](!{docsLatest}/guide/template-syntax.html#property-binding).
|
* [Property binding](!{docsLatest}/guide/template-syntax.html#property-binding).
|
||||||
* [Event Binding](!{docsLatest}/guide/template-syntax.html#event-binding).
|
* [Event binding](!{docsLatest}/guide/template-syntax.html#event-binding).
|
||||||
* [Attribute Binding](!{docsLatest}/guide/template-syntax.html#attribute-binding).
|
* [Attribute binding](!{docsLatest}/guide/template-syntax.html#attribute-binding).
|
||||||
* [Class Binding](!{docsLatest}/guide/template-syntax.html#class-binding).
|
* [Class binding](!{docsLatest}/guide/template-syntax.html#class-binding).
|
||||||
* [Style Binding](!{docsLatest}/guide/template-syntax.html#style-binding).
|
* [Style binding](!{docsLatest}/guide/template-syntax.html#style-binding).
|
||||||
* [Two-way data binding with ngModel](!{docsLatest}/guide/template-syntax.html#ng-model).
|
* [Two-way data binding with ngModel](!{docsLatest}/guide/template-syntax.html#ngModel).
|
||||||
|
|
||||||
Read more about data binding in the
|
|
||||||
[Template Syntax](!{docsLatest}/guide/template-syntax.html#data-binding) chapter.
|
|
||||||
|
|
||||||
+ifDocsFor('ts|dart')
|
+ifDocsFor('ts|dart')
|
||||||
a#decorator
|
a#decorator
|
||||||
a#decoration
|
a#decoration
|
||||||
:marked
|
:marked
|
||||||
## Decorator | Decoration
|
## Decorator | decoration
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
block decorator-defn
|
block decorator-defn
|
||||||
:marked
|
:marked
|
||||||
A Decorator is a **function** that adds metadata to a class, its members (properties, methods) and function arguments.
|
A decorator is 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 (AKA ES7).
|
Decorators are a JavaScript language [feature](https://github.com/wycats/javascript-decorators), implemented in TypeScript and proposed for ES2016 (AKA ES7).
|
||||||
|
|
||||||
@ -223,7 +216,7 @@ block includes
|
|||||||
|
|
||||||
Angular has its own set of decorators to help it interoperate with your application parts.
|
Angular has its own set of decorators to help it interoperate with your application parts.
|
||||||
Here is an example of a `@Component` decorator that identifies a
|
Here is an example of a `@Component` decorator that identifies a
|
||||||
class as an Angular [Component](#component) and an `@Input` decorator applied to the `name` property
|
class as an Angular [component](#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.
|
of that component. The elided object argument to the `@Component` decorator would contain the pertinent component metadata.
|
||||||
```
|
```
|
||||||
@Component({...})
|
@Component({...})
|
||||||
@ -241,10 +234,10 @@ block includes
|
|||||||
Always include parentheses `()` when applying a decorator.
|
Always include parentheses `()` when applying a decorator.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Dependency Injection
|
## Dependency injection
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
Dependency Injection is both a design pattern and a mechanism
|
Dependency injection is both a design pattern and a mechanism
|
||||||
for creating and delivering parts of an application to other
|
for creating and delivering parts of an application to other
|
||||||
parts of an application that request them.
|
parts of an application that request them.
|
||||||
|
|
||||||
@ -256,17 +249,17 @@ block includes
|
|||||||
part "A" relies on another part "B", you say that "A" depends on "B" and
|
part "A" relies on another part "B", you say that "A" depends on "B" and
|
||||||
that "B" is a dependency of "A".
|
that "B" is a dependency of "A".
|
||||||
|
|
||||||
You can ask a "Dependency Injection System" to create "A"
|
You can ask a "dependency injection system" to create "A"
|
||||||
for us and handle all the dependencies.
|
for us and handle all the dependencies.
|
||||||
If "A" needs "B" and "B" needs "C", the system resolves that chain of dependencies
|
If "A" needs "B" and "B" needs "C", the system resolves that chain of dependencies
|
||||||
and returns a fully prepared instance of "A".
|
and returns a fully prepared instance of "A".
|
||||||
|
|
||||||
Angular provides and relies upon its own sophisticated
|
Angular provides and relies upon its own sophisticated
|
||||||
[Dependency Injection](dependency-injection.html) system
|
[dependency injection](dependency-injection.html) system
|
||||||
to assemble and run applications by "injecting" application parts
|
to assemble and run applications by "injecting" application parts
|
||||||
into other application parts where and when needed.
|
into other application parts where and when needed.
|
||||||
|
|
||||||
At the core there is an [`Injector`](#injector) that returns dependency values on request.
|
At the core there is an [`injector`](#injector) that returns dependency values on request.
|
||||||
The expression `injector.get(token)` returns the value associated with the given token.
|
The expression `injector.get(token)` returns the value associated with the given token.
|
||||||
|
|
||||||
A token is an Angular type (`OpaqueToken`). You rarely deal with tokens directly; most
|
A token is an Angular type (`OpaqueToken`). You rarely deal with tokens directly; most
|
||||||
@ -274,23 +267,23 @@ block includes
|
|||||||
to a token. When you write `injector.get(Foo)`, the injector returns
|
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.
|
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`](#component) for display.
|
During many of its operations, Angular makes similar requests internally, such as when it creates a [`component`](#component) for display.
|
||||||
|
|
||||||
The `Injector` maintains an internal map of tokens to dependency values.
|
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
|
If the `Injector` can't find a value for a given token, it creates
|
||||||
a new value using a `Provider` for that token.
|
a new value using a `Provider` for that token.
|
||||||
|
|
||||||
A [Provider](#provider) is a recipe for
|
A [provider](#provider) is a recipe for
|
||||||
creating new instances of a dependency value associated with a particular token.
|
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
|
An injector can only create a value for a given token if it has
|
||||||
a `Provider` for that token in its internal provider registry.
|
a `provider` for that token in its internal provider registry.
|
||||||
Registering providers is a critical preparatory step.
|
Registering providers is a critical preparatory step.
|
||||||
|
|
||||||
Angular registers some of its own providers with every injector.
|
Angular registers some of its own providers with every injector.
|
||||||
We can register our own providers.
|
We can register our own providers.
|
||||||
|
|
||||||
Learn more in the [Dependency Injection](!{docsLatest}/guide/dependency-injection.html) page.
|
Read more in the [Dependency Injection](!{docsLatest}/guide/dependency-injection.html) page.
|
||||||
:marked
|
:marked
|
||||||
## Directive
|
## Directive
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
@ -304,7 +297,7 @@ block includes
|
|||||||
it creates the matching directive class instance
|
it creates the matching directive class instance
|
||||||
and gives the instance control over that portion of the browser DOM.
|
and gives the instance control over that portion of the browser DOM.
|
||||||
|
|
||||||
You can invent custom HTML markup (e.g., `<my-directive>`) to
|
You can invent custom HTML markup (for example, `<my-directive>`) to
|
||||||
associate with your custom directives. You add this custom markup to HTML templates
|
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
|
as if you were writing native HTML. In this way, directives become extensions of
|
||||||
HTML itself.
|
HTML itself.
|
||||||
@ -316,11 +309,11 @@ block includes
|
|||||||
They are the building blocks of an Angular application and the
|
They are the building blocks of an Angular application and the
|
||||||
developer can expect to write a lot of them.
|
developer can expect to write a lot of them.
|
||||||
|
|
||||||
1. [Attribute Directives](#attribute-directive) that can listen to and modify the behavior of
|
1. [Attribute directives](#attribute-directive) that can listen to and modify the behavior of
|
||||||
other HTML elements, attributes, properties, and components. They are usually represented
|
other HTML elements, attributes, properties, and components. They are usually represented
|
||||||
as HTML attributes, hence the name.
|
as HTML attributes, hence the name.
|
||||||
|
|
||||||
1. [Structural Directives](#structural-directive), a directive responsible for
|
1. [Structural directives](#structural-directive), a directive responsible for
|
||||||
shaping or reshaping HTML layout, typically by adding, removing, or manipulating
|
shaping or reshaping HTML layout, typically by adding, removing, or manipulating
|
||||||
elements and their children.
|
elements and their children.
|
||||||
|
|
||||||
@ -336,7 +329,7 @@ block includes
|
|||||||
[ECMAScript 2016](http://www.ecma-international.org/ecma-262/7.0/)
|
[ECMAScript 2016](http://www.ecma-international.org/ecma-262/7.0/)
|
||||||
(AKA "ES2016" or "ES7") and many Angular 2 developers write their applications
|
(AKA "ES2016" or "ES7") and many Angular 2 developers write their applications
|
||||||
either in this version of the language or a dialect that strives to be
|
either in this version of the language or a dialect that strives to be
|
||||||
compatible with it, such as [TypeScript](#typesScript).
|
compatible with it, such as [TypeScript](#typescript).
|
||||||
|
|
||||||
Most modern browsers today only support the much older "ECMAScript 5" (AKA ES5) standard.
|
Most modern browsers today only support the much older "ECMAScript 5" (AKA ES5) standard.
|
||||||
Applications written in ES2016, ES2015 or one of their dialects must be "[transpiled](#transpile)"
|
Applications written in ES2016, ES2015 or one of their dialects must be "[transpiled](#transpile)"
|
||||||
@ -378,17 +371,17 @@ a#H
|
|||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A directive property that can be the ***target*** of a
|
A directive property that can be the ***target*** of a
|
||||||
[Property Binding](!{docsLatest}/guide/template-syntax.html#property-binding).
|
[property binding](!{docsLatest}/guide/template-syntax.html#property-binding) (explained in detail in the [Template Syntax](!{docsLatest}/guide/template-syntax.html) page).
|
||||||
Data values flow *into* this property from the data source identified
|
Data values flow *into* this property from the data source identified
|
||||||
in the template expression to the right of the equal sign.
|
in the template expression to the right of the equal sign.
|
||||||
|
|
||||||
See the [Template Syntax](!{docsLatest}/guide/template-syntax.html#inputs-outputs) page.
|
See the [Input and output properties](!{docsLatest}/guide/template-syntax.html#inputs-outputs) section of the [Template Syntax](!{docsLatest}/guide/template-syntax.html) page.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Interpolation
|
## Interpolation
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A form of [Property Data Binding](#data-binding) in which a
|
A form of [property data binding](#data-binding) in which a
|
||||||
[template expression](#template-expression) between double-curly braces
|
[template expression](#template-expression) between double-curly braces
|
||||||
renders as text. That text may be concatenated with neighboring text
|
renders as text. That text may be concatenated with neighboring text
|
||||||
before it is assigned to an element property
|
before it is assigned to an element property
|
||||||
@ -398,20 +391,20 @@ a#H
|
|||||||
<label>My current hero is {{hero.name}}</label>
|
<label>My current hero is {{hero.name}}</label>
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
Read more about interpolation in the
|
Read more about [interpolation](!{docsLatest}/guide/template-syntax.html#interpolation) in the
|
||||||
[Template Syntax](!{docsLatest}/guide/template-syntax.html#interpolation) page.
|
[Template Syntax](!{docsLatest}/guide/template-syntax.html) page.
|
||||||
|
|
||||||
.l-main-section#J
|
.l-main-section#J
|
||||||
|
|
||||||
+ifDocsFor('ts')
|
+ifDocsFor('ts')
|
||||||
a#jit
|
a#jit
|
||||||
:marked
|
:marked
|
||||||
## Just in Time (JIT) Compilation
|
## Just-in-time (JiT) compilation
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
With Angular _Just in Time_ bootstrapping you compile your components and modules in the browser
|
With Angular _just-in-time_ bootstrapping you compile your components and modules in the browser
|
||||||
and launch the application dynamically. This is a good choice during development.
|
and launch the application dynamically. This is a good choice during development.
|
||||||
Consider using the [Ahead of Time](#aot) mode for production apps.
|
Consider using the [ahead-of-time](#aot) mode for production apps.
|
||||||
|
|
||||||
.l-main-section#K
|
.l-main-section#K
|
||||||
:marked
|
:marked
|
||||||
@ -422,14 +415,14 @@ a#H
|
|||||||
|
|
||||||
.l-main-section#L
|
.l-main-section#L
|
||||||
:marked
|
:marked
|
||||||
## Lifecycle Hooks
|
## Lifecycle hooks
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
[Directives](#directive) and [Components](#component) have a lifecycle
|
[Directives](#directive) and [components](#component) have a lifecycle
|
||||||
managed by Angular as it creates, updates, and destroys them.
|
managed by Angular as it creates, updates, and destroys them.
|
||||||
|
|
||||||
You can tap into key moments in that lifecycle by implementing
|
You can tap into key moments in that lifecycle by implementing
|
||||||
one or more of the "Lifecycle Hook" interfaces.
|
one or more of the lifecycle hook interfaces.
|
||||||
|
|
||||||
Each interface has a single hook method whose name is the interface name prefixed with `ng`.
|
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`.
|
For example, the `OnInit` interface has a hook method named `ngOnInit`.
|
||||||
@ -456,7 +449,7 @@ a#H
|
|||||||
:marked
|
:marked
|
||||||
In Angular, there are two types of modules:
|
In Angular, there are two types of modules:
|
||||||
- [Angular modules](#angular-module).
|
- [Angular modules](#angular-module).
|
||||||
For details and examples, see the [Angular Module](!{docsLatest}/guide/ngmodule.html) page.
|
For details and examples, see the [Angular Modules](!{docsLatest}/guide/ngmodule.html) page.
|
||||||
- ES2015 modules, as described in this section.
|
- ES2015 modules, as described in this section.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
@ -503,12 +496,12 @@ a#N
|
|||||||
## Output
|
## Output
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A directive property that can be the ***target*** of an
|
A directive property that can be the ***target*** of
|
||||||
[Event Binding](!{docsLatest}/guide/template-syntax.html#property-binding).
|
[event binding](!{docsLatest}/guide/template-syntax.html#event-binding).
|
||||||
Events stream *out* of this property to the receiver identified
|
Events stream *out* of this property to the receiver identified
|
||||||
in the template expression to the right of the equal sign.
|
in the template expression to the right of the equal sign.
|
||||||
|
|
||||||
See the [Template Syntax](!{docsLatest}/guide/template-syntax.html#inputs-outputs) page.
|
See the [Input and output properties](!{docsLatest}/guide/template-syntax.html#inputs-outputs) section of the [Template Syntax](!{docsLatest}/guide/template-syntax.html) page.
|
||||||
|
|
||||||
.l-main-section#P
|
.l-main-section#P
|
||||||
|
|
||||||
@ -518,8 +511,7 @@ a#N
|
|||||||
:marked
|
:marked
|
||||||
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. Examples include: `Person` and `HeroDetailComponent`.
|
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. Examples include: `Person` and `HeroDetailComponent`.
|
||||||
|
|
||||||
This form is also known as **upper camel case** to distinguish it from **lower camel case** which we simply call [camelCase](#camelcase).
|
This form is also known as **upper camel case** to distinguish it from **lower camel case**, which is simply called [camelCase](#camelcase). In this documentation, "PascalCase" means *upper camel case* and "camelCase" means *lower camel case*.
|
||||||
In this documentation, "PascalCase" means *upper camel case* and "camelCase" means *lower camel case*.
|
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Pipe
|
## Pipe
|
||||||
@ -543,8 +535,8 @@ a#N
|
|||||||
## Provider
|
## Provider
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A [Provider](!{_ProviderUrl}) creates a new instance of a dependency for the
|
A [provider](!{_ProviderUrl}) creates a new instance of a dependency for the
|
||||||
[Dependency Injection](#dependency-injection) system.
|
[dependency injection](#dependency-injection) system.
|
||||||
It relates a lookup token to code—sometimes called a "recipe"—that can create a dependency value.
|
It relates a lookup token to code—sometimes called a "recipe"—that can create a dependency value.
|
||||||
|
|
||||||
a#Q
|
a#Q
|
||||||
@ -552,7 +544,7 @@ a#Q
|
|||||||
|
|
||||||
+ifDocsFor('ts|js')
|
+ifDocsFor('ts|js')
|
||||||
:marked
|
:marked
|
||||||
## Reactive Forms
|
## Reactive forms
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A technique for building Angular forms through code in a component.
|
A technique for building Angular forms through code in a component.
|
||||||
@ -575,7 +567,7 @@ a#Q
|
|||||||
and performing other similar actions that cause the application to
|
and performing other similar actions that cause the application to
|
||||||
replace one view with another.
|
replace one view with another.
|
||||||
|
|
||||||
The Angular [Component Router](!{docsLatest}/guide/router.html) is a richly featured mechanism for configuring and managing the entire view navigation process including the creation and destruction
|
The Angular [component router](!{docsLatest}/guide/router.html) is a richly featured mechanism for configuring and managing the entire view navigation process including the creation and destruction
|
||||||
of views.
|
of views.
|
||||||
+ifDocsFor('ts|js')
|
+ifDocsFor('ts|js')
|
||||||
:marked
|
:marked
|
||||||
@ -588,31 +580,31 @@ a#Q
|
|||||||
Other views in the application likely have anchor tags or buttons with `RouterLink`
|
Other views in the application likely have anchor tags or buttons with `RouterLink`
|
||||||
directives that users can click to navigate.
|
directives that users can click to navigate.
|
||||||
|
|
||||||
For more information, see the [Component Router](!{docsLatest}/guide/router.html) page.
|
For more information, see the [Routing & Navigation](!{docsLatest}/guide/router.html) page.
|
||||||
|
|
||||||
+ifDocsFor('ts|js')
|
+ifDocsFor('ts|js')
|
||||||
:marked
|
:marked
|
||||||
## RouterModule
|
## Router module
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A separate [Angular module](#angular-module) that provides the necessary service providers and directives for navigating through application views.
|
A separate [Angular module](#angular-module) that provides the necessary service providers and directives for navigating through application views.
|
||||||
|
|
||||||
For more information, see the [Component Router](!{docsLatest}/guide/router.html) page.
|
For more information, see the [Routing & Navigation](!{docsLatest}/guide/router.html) page.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Routing Component
|
## Routing component
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
block routing-component-defn
|
block routing-component-defn
|
||||||
:marked
|
:marked
|
||||||
An Angular [Component](#component) with a RouterOutlet that displays views based on router navigations.
|
An Angular [component](#component) with a RouterOutlet that displays views based on router navigations.
|
||||||
|
|
||||||
For more information, see the [Component Router](!{docsLatest}/guide/router.html) page.
|
For more information, see the [Routing & Navigation](!{docsLatest}/guide/router.html) page.
|
||||||
|
|
||||||
.l-main-section#S
|
.l-main-section#S
|
||||||
|
|
||||||
+ifDocsFor('ts|js')
|
+ifDocsFor('ts|js')
|
||||||
:marked
|
:marked
|
||||||
## Scoped Package
|
## Scoped package
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
Angular modules are delivered within *scoped packages* such as `@angular/core`, `@angular/common`, `@angular/platform-browser-dynamic`,
|
Angular modules are delivered within *scoped packages* such as `@angular/core`, `@angular/common`, `@angular/platform-browser-dynamic`,
|
||||||
@ -650,13 +642,13 @@ a#snake-case
|
|||||||
independent from any specific view,
|
independent from any specific view,
|
||||||
provide shared data or logic across components, or encapsulate external interactions.
|
provide shared data or logic across components, or encapsulate external interactions.
|
||||||
|
|
||||||
For more information, see the [Services](!{docsLatest}/tutorial/toh-pt4.html) page.
|
For more information, see the [Services](!{docsLatest}/tutorial/toh-pt4.html) page of the [Tour of Heroes](!{docsLatest}/tutorial/) tutorial.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Structural Directive
|
## Structural directive
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A category of [Directive](#directive) that can
|
A category of [directive](#directive) that can
|
||||||
shape or reshape HTML layout, typically by adding, removing, or manipulating
|
shape or reshape HTML layout, typically by adding, removing, or manipulating
|
||||||
elements and their children; for example, the `ngIf` "conditional element" directive and the `ngFor` "repeater" directive.
|
elements and their children; for example, the `ngIf` "conditional element" directive and the `ngFor` "repeater" directive.
|
||||||
|
|
||||||
@ -668,13 +660,13 @@ a#snake-case
|
|||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A template is a chunk of HTML that Angular uses to render a [view](#view) with
|
A template is a chunk of HTML that Angular uses to render a [view](#view) with
|
||||||
the support and continuing guidance of an Angular [Directive](#directive),
|
the support and continuing guidance of an Angular [directive](#directive),
|
||||||
most notably a [Component](#component).
|
most notably a [component](#component).
|
||||||
|
|
||||||
|
|
||||||
+ifDocsFor('ts|js')
|
+ifDocsFor('ts|js')
|
||||||
:marked
|
:marked
|
||||||
## Template-Driven Forms
|
## Template-driven forms
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A technique for building Angular forms using HTML forms and input elements in the view.
|
A technique for building Angular forms using HTML forms and input elements in the view.
|
||||||
@ -683,20 +675,20 @@ a#snake-case
|
|||||||
When building template-driven forms:
|
When building template-driven forms:
|
||||||
- The "source of truth" is the template. The validation is defined using attributes on the individual input elements.
|
- The "source of truth" is the template. The validation is defined using attributes on the individual input elements.
|
||||||
- [Two-way binding](#data-binding) with `ngModel` keeps the component model in synchronization with the user's entry into the input elements.
|
- [Two-way binding](#data-binding) with `ngModel` keeps the component model in synchronization 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.
|
- 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`.
|
- 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.
|
Template-driven forms are convenient, quick, and simple. They are a good choice for many basic data entry form scenarios.
|
||||||
|
|
||||||
Learn how to build template-driven forms
|
Read about how to build template-driven forms
|
||||||
in the [Forms](!{docsLatest}/guide/forms.html) chapter.
|
in the [Forms](!{docsLatest}/guide/forms.html) page.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Template Expression
|
## Template expression
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
An expression is a !{_Lang}-like syntax that Angular evaluates within
|
An expression is a !{_Lang}-like syntax that Angular evaluates within
|
||||||
a [data binding](#data-binding).
|
a [data binding](#data-binding).
|
||||||
|
|
||||||
Read about how to write template expressions
|
Read about how to write template expressions
|
||||||
in the [Template Syntax](!{docsLatest}/guide/template-syntax.html#template-expressions) page.
|
in the [Template Syntax](!{docsLatest}/guide/template-syntax.html#template-expressions) page.
|
||||||
@ -713,7 +705,7 @@ a#snake-case
|
|||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A version of JavaScript that supports most [ECMAScript 2015](#ecmascript=2015)
|
A version of JavaScript that supports most [ECMAScript 2015](#ecmascript=2015)
|
||||||
language features such as [Decorators](#decorator).
|
language features such as [decorators](#decorator).
|
||||||
|
|
||||||
TypeScript is also noteable for its optional typing system, which gives
|
TypeScript is also noteable for its optional typing system, which gives
|
||||||
us compile-time type checking and strong tooling support (for example, "intellisense",
|
us compile-time type checking and strong tooling support (for example, "intellisense",
|
||||||
@ -723,7 +715,7 @@ a#snake-case
|
|||||||
TypeScript is the preferred language for Angular 2 development although
|
TypeScript is the preferred language for Angular 2 development although
|
||||||
you can use other JavaScript dialects such as [ES5](#es5).
|
you can use other JavaScript dialects such as [ES5](#es5).
|
||||||
|
|
||||||
Read more about TypeScript on its [website](http://www.typescriptlang.org/).
|
Read more about TypeScript at [typescript.org](http://www.typescriptlang.org/).
|
||||||
|
|
||||||
a#U
|
a#U
|
||||||
.l-main-section#V
|
.l-main-section#V
|
||||||
@ -735,9 +727,9 @@ a#U
|
|||||||
A view is a portion of the screen that displays information and responds
|
A view is a portion of the screen that displays information and responds
|
||||||
to user actions such as clicks, mouse moves, and keystrokes.
|
to user actions such as clicks, mouse moves, and keystrokes.
|
||||||
|
|
||||||
Angular renders a view under the control of one or more [Directives](#directive),
|
Angular renders a view under the control of one or more [directives](#directive),
|
||||||
especially [Component](#component) directives and their companion [Templates](#template).
|
especially [component](#component) directives and their companion [templates](#template).
|
||||||
The Component plays such a prominent role that it's often
|
The component plays such a prominent role that it's often
|
||||||
convenient to refer to a component as a view.
|
convenient to refer to a component as a view.
|
||||||
|
|
||||||
Views often contain other views and any view might be loaded and unloaded
|
Views often contain other views and any view might be loaded and unloaded
|
||||||
|
Loading…
x
Reference in New Issue
Block a user