a1-a2 quick ref copy edits (#2255)
* a1-a2 quick ref copy edits * copy edits, 2nd pass * Glossary Edits * 1-2 quick ref copy edits, pass 2
This commit is contained in:
parent
07cfce795f
commit
c5a1a88042
@ -2,31 +2,29 @@ include ../_util-fns
|
|||||||
a(id="top")
|
a(id="top")
|
||||||
:marked
|
:marked
|
||||||
There are many conceptual and syntactical differences between Angular 1 and Angular 2.
|
There are many conceptual and syntactical differences between Angular 1 and Angular 2.
|
||||||
This chapter provides a quick reference guide to some of the common Angular 1
|
This page provides a quick guide to some common Angular 1
|
||||||
syntax and its equivalent in Angular 2.
|
syntax and its equivalent in Angular 2.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
**See the Angular 2 syntax in this <live-example name="cb-a1-a2-quick-reference"></live-example>**.
|
**See the Angular 2 syntax in this <live-example name="cb-a1-a2-quick-reference"></live-example>**.
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
This chapter covers
|
This page covers:
|
||||||
* [Template Basics](#template-basics) - binding and local variables
|
* [Template basics](#template-basics) - binding and local variables.
|
||||||
|
|
||||||
* [Template Directives](#template-directives) - built-in directives `ngIf` and `ngClass`
|
* [Template directives](#template-directives) - built-in directives `ngIf` and `ngClass`.
|
||||||
|
|
||||||
* [Filters/Pipes](#filters-pipes) - built-in *filters*, known as *pipes* in Angular 2
|
* [Filters/pipes](#filters-pipes) - built-in *filters*, known as *pipes* in Angular 2.
|
||||||
|
|
||||||
* [Modules/Controllers/Components](#controllers-components) - *modules* are *modules* but different
|
* [Modules/controllers/components](#controllers-components) - *modules* in Angular 2 are slightly different from *modules* in Angular 1, and *controllers* are *components* in Angular 2.
|
||||||
and *controllers* are *components* in Angular 2.
|
|
||||||
|
|
||||||
* [Style Sheets](#style-sheets) - more options for CSS in Angular 2.
|
* [Style sheets](#style-sheets) - more options for CSS than in Angular 1.
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
## Template Basics
|
## Template basics
|
||||||
Templates are the user-facing part of an Angular application and are written in HTML.
|
Templates are the user-facing part of an Angular application and are written in HTML.
|
||||||
The following are some of the key Angular 1 template features with the equivalent
|
The following table lists some of the key Angular 1 template features with their equivalent Angular 2 template syntax.
|
||||||
template syntax in Angular 2.
|
|
||||||
|
|
||||||
- var top="vertical-align:top"
|
- var top="vertical-align:top"
|
||||||
table(width="100%")
|
table(width="100%")
|
||||||
@ -38,7 +36,7 @@ table(width="100%")
|
|||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### Bindings/Interpolation
|
### Bindings/interpolation
|
||||||
code-example.
|
code-example.
|
||||||
Your favorite hero is: {{vm.favoriteHero}}
|
Your favorite hero is: {{vm.favoriteHero}}
|
||||||
:marked
|
:marked
|
||||||
@ -47,11 +45,11 @@ table(width="100%")
|
|||||||
associated with this template.
|
associated with this template.
|
||||||
|
|
||||||
When using the `controller as` syntax,
|
When using the `controller as` syntax,
|
||||||
the binding is prefixed with the controller alias (`vm` or `$ctrl`) because we
|
the binding is prefixed with the controller alias (`vm` or `$ctrl`) because you
|
||||||
have to be specific about the source of the binding.
|
have to be specific about the source of the binding.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### Bindings/Interpolation
|
### Bindings/interpolation
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'interpolation')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'interpolation')(format="." )
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, a template expression in curly braces still denotes one-way binding.
|
In Angular 2, a template expression in curly braces still denotes one-way binding.
|
||||||
@ -59,7 +57,7 @@ table(width="100%")
|
|||||||
The context of the binding is implied and is always the
|
The context of the binding is implied and is always the
|
||||||
associated component, so it needs no reference variable.
|
associated component, so it needs no reference variable.
|
||||||
|
|
||||||
For more information see [Template Syntax](../guide/template-syntax.html#interpolation).
|
For more information, see the [Interpolation](../guide/template-syntax.html#interpolation) section of the Template Syntax page.
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -67,19 +65,19 @@ table(width="100%")
|
|||||||
code-example.
|
code-example.
|
||||||
<td>{{movie.title | uppercase}}</td>
|
<td>{{movie.title | uppercase}}</td>
|
||||||
:marked
|
:marked
|
||||||
To filter output in our templates in Angular 1, we use the pipe character (|) and one or more filters.
|
To filter output in Angular 1 templates, use the pipe character (|) and one or more filters.
|
||||||
|
|
||||||
In this example, we filter the `title` property to uppercase.
|
This example filters the `title` property to uppercase.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### Pipes
|
### Pipes
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'uppercase')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'uppercase')(format="." )
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, we use similar syntax with the pipe (|) character to filter output, but now we call them **pipes**.
|
In Angular 2 you use similar syntax with the pipe (|) character to filter output, but now you call them **pipes**.
|
||||||
Many (but not all) of the built-in filters from Angular 1 are
|
Many (but not all) of the built-in filters from Angular 1 are
|
||||||
built-in pipes in Angular 2.
|
built-in pipes in Angular 2.
|
||||||
|
|
||||||
See the heading [Filters / Pipes](#Pipes) below for more information.
|
For more information, see the heading [Filters/pipes](#Pipes) below.
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -95,18 +93,18 @@ table(width="100%")
|
|||||||
### Input variables
|
### Input variables
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'local')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'local')(format="." )
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, we have true template input variables that are explicitly defined using the `let` keyword.
|
Angular 2 has true template input variables that are explicitly defined using the `let` keyword.
|
||||||
|
|
||||||
For more information see [ngFor micro-syntax](../guide/template-syntax.html#ngForMicrosyntax).
|
For more information, see the [ngFor micro-syntax](../guide/template-syntax.html#ngForMicrosyntax) section of the Template Syntax page.
|
||||||
:marked
|
:marked
|
||||||
[Back to top](#top)
|
[Back to top](#top)
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
## Template Directives
|
## Template directives
|
||||||
Angular 1 provides over seventy built-in directives for use in our templates.
|
Angular 1 provides more than seventy built-in directives for templates.
|
||||||
Many of them are no longer needed in Angular 2 because of its more capable and expressive binding system.
|
Many of them aren't needed in Angular 2 because of its more capable and expressive binding system.
|
||||||
The following are some of the key Angular 1 built-in directives and the equivalent feature in Angular 2.
|
The following are some of the key Angular 1 built-in directives and their equivalents in Angular 2.
|
||||||
|
|
||||||
table(width="100%")
|
table(width="100%")
|
||||||
col(width="50%")
|
col(width="50%")
|
||||||
@ -123,7 +121,7 @@ table(width="100%")
|
|||||||
:marked
|
:marked
|
||||||
The application startup process is called **bootstrapping**.
|
The application startup process is called **bootstrapping**.
|
||||||
|
|
||||||
Although we can bootstrap an Angular 1 app in code,
|
Although you can bootstrap an Angular 1 app in code,
|
||||||
many applications bootstrap declaratively with the `ng-app` directive,
|
many applications bootstrap declaratively with the `ng-app` directive,
|
||||||
giving it the name of the application's module (`movieHunter`).
|
giving it the name of the application's module (`movieHunter`).
|
||||||
td
|
td
|
||||||
@ -134,8 +132,8 @@ table(width="100%")
|
|||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/app.module.1.ts','','app.module.ts')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/app.module.1.ts','','app.module.ts')(format="." )
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
Angular 2 does not have a bootstrap directive.
|
Angular 2 doesn't have a bootstrap directive.
|
||||||
We always launch the app in code by explicitly bootstrapping the application's root module (`AppModule`)
|
To launch the app in code, explicitly bootstrap the application's root module (`AppModule`)
|
||||||
in `main.ts`
|
in `main.ts`
|
||||||
and the application's root component (`AppComponent`) in `app.module.ts`.
|
and the application's root component (`AppComponent`) in `app.module.ts`.
|
||||||
|
|
||||||
@ -156,7 +154,7 @@ table(width="100%")
|
|||||||
|
|
||||||
In the first example, the `active` class is applied to the element if `isActive` is true.
|
In the first example, the `active` class is applied to the element if `isActive` is true.
|
||||||
|
|
||||||
We can specify multiple classes as shown in the second example.
|
You can specify multiple classes, as shown in the second example.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### ngClass
|
### ngClass
|
||||||
@ -167,12 +165,12 @@ table(width="100%")
|
|||||||
|
|
||||||
In the first example, the `active` class is applied to the element if `isActive` is true.
|
In the first example, the `active` class is applied to the element if `isActive` is true.
|
||||||
|
|
||||||
We can specify multiple classes as shown in the second example.
|
You can specify multiple classes, as shown in the second example.
|
||||||
|
|
||||||
Angular 2 also has **class binding**, which is a good way to add or remove a single class
|
Angular 2 also has **class binding**, which is a good way to add or remove a single class,
|
||||||
as shown in the third example.
|
as shown in the third example.
|
||||||
|
|
||||||
For more information see [Template Syntax](../guide/template-syntax.html#other-bindings).
|
For more information see the [Attribute, Class, and Style Bindings](../guide/template-syntax.html#other-bindings) section of the Template Syntax page.
|
||||||
|
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
@ -182,9 +180,9 @@ table(width="100%")
|
|||||||
<button ng-click="vm.toggleImage()">
|
<button ng-click="vm.toggleImage()">
|
||||||
<button ng-click="vm.toggleImage($event)">
|
<button ng-click="vm.toggleImage($event)">
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, the `ng-click` directive allows us to specify custom behavior when an element is clicked.
|
In Angular 1, the `ng-click` directive allows you to specify custom behavior when an element is clicked.
|
||||||
|
|
||||||
In the first example, when the button is clicked, the `toggleImage()` method in the controller referenced by the `vm` `controller as` alias is executed.
|
In the first example, when the user clicks the button, the `toggleImage()` method in the controller referenced by the `vm` `controller as` alias is executed.
|
||||||
|
|
||||||
The second example demonstrates passing in the `$event` object, which provides details about the event
|
The second example demonstrates passing in the `$event` object, which provides details about the event
|
||||||
to the controller.
|
to the controller.
|
||||||
@ -193,22 +191,22 @@ table(width="100%")
|
|||||||
### bind to the `click` event
|
### bind to the `click` event
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'event-binding')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'event-binding')(format="." )
|
||||||
:marked
|
:marked
|
||||||
The Angular 1 event-based directives do not exist in Angular 2.
|
Angular 1 event-based directives do not exist in Angular 2.
|
||||||
Rather, we define one-way binding from the template view to the component using **event binding**.
|
Rather, define one-way binding from the template view to the component using **event binding**.
|
||||||
|
|
||||||
For event binding, we define the name of the target event within parenthesis and
|
For event binding, define the name of the target event within parenthesis and
|
||||||
specify a template statement in quotes to the right of the equals. Angular 2 then
|
specify a template statement, in quotes, to the right of the equals. Angular 2 then
|
||||||
sets up an event handler for the target event. When the event is raised, the handler
|
sets up an event handler for the target event. When the event is raised, the handler
|
||||||
executes the template statement.
|
executes the template statement.
|
||||||
|
|
||||||
In the first example, when the button is clicked, the `toggleImage()` method in the associated component is executed.
|
In the first example, when a user clicks the button, the `toggleImage()` method in the associated component is executed.
|
||||||
|
|
||||||
The second example demonstrates passing in the `$event` object, which provides details about the event
|
The second example demonstrates passing in the `$event` object, which provides details about the event
|
||||||
to the component.
|
to the component.
|
||||||
|
|
||||||
For a list of DOM events, see: https://developer.mozilla.org/en-US/docs/Web/Events.
|
For a list of DOM events, see: https://developer.mozilla.org/en-US/docs/Web/Events.
|
||||||
|
|
||||||
For more information see [Template Syntax](../guide/template-syntax.html#event-binding).
|
For more information, see the [Event Binding](../guide/template-syntax.html#event-binding) section of the Template Syntax page.
|
||||||
|
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
@ -228,19 +226,19 @@ table(width="100%")
|
|||||||
In Angular 2, the template no longer specifies its associated controller.
|
In Angular 2, the template no longer specifies its associated controller.
|
||||||
Rather, the component specifies its associated template as part of the component class decorator.
|
Rather, the component specifies its associated template as part of the component class decorator.
|
||||||
|
|
||||||
For more information see [Architecture Overview](../guide/architecture.html#component).
|
For more information, see [Architecture Overview](../guide/architecture.html#component).
|
||||||
|
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### ng-hide
|
### ng-hide
|
||||||
In Angular 1, the `ng-hide` directive shows or hides the associated HTML element based on
|
In Angular 1, the `ng-hide` directive shows or hides the associated HTML element based on
|
||||||
an expression. See [ng-show](#ng-show) for more information.
|
an expression. For more information, see [ng-show](#ng-show).
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### bind to the `hidden` property
|
### bind to the `hidden` property
|
||||||
In Angular 2, we use property binding; there is no built-in *hide* directive.
|
In Angular 2, you use property binding; there is no built-in *hide* directive.
|
||||||
See [ng-show](#ng-show) for more information.
|
For more information, see [ng-show](#ng-show).
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -248,7 +246,7 @@ table(width="100%")
|
|||||||
code-example(format="").
|
code-example(format="").
|
||||||
<a ng-href="angularDocsUrl">Angular Docs</a>
|
<a ng-href="angularDocsUrl">Angular Docs</a>
|
||||||
:marked
|
:marked
|
||||||
The `ng-href` directive allows Angular 1 to preprocess the `href` property so it
|
The `ng-href` directive allows Angular 1 to preprocess the `href` property so that it
|
||||||
can replace the binding expression with the appropriate URL before the browser
|
can replace the binding expression with the appropriate URL before the browser
|
||||||
fetches from that URL.
|
fetches from that URL.
|
||||||
|
|
||||||
@ -262,15 +260,15 @@ table(width="100%")
|
|||||||
### bind to the `href` property
|
### bind to the `href` property
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'href')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'href')(format="." )
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, we use property binding; there is no built-in *href* directive.
|
Angular 2, uses property binding; there is no built-in *href* directive.
|
||||||
We place the element's `href` property in square brackets and set it to a quoted template expression.
|
Place the element's `href` property in square brackets and set it to a quoted template expression.
|
||||||
|
|
||||||
For more information on property binding see [Template Syntax](../guide/template-syntax.html#property-binding).
|
For more information on property binding, see [Template Syntax](../guide/template-syntax.html#property-binding).
|
||||||
|
|
||||||
In Angular 2, `href` is no longer used for routing. Routing uses `routerLink` as shown in the third example.
|
In Angular 2, `href` is no longer used for routing. Routing uses `routerLink`, as shown in the third example.
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'router-link')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'router-link')(format="." )
|
||||||
:marked
|
:marked
|
||||||
For more information on routing see [Routing & Navigation](../guide/router.html#router-link).
|
For more information on routing, see [Routing & Navigation](../guide/router.html#router-link).
|
||||||
|
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
@ -279,7 +277,7 @@ table(width="100%")
|
|||||||
code-example(format="").
|
code-example(format="").
|
||||||
<table ng-if="movies.length">
|
<table ng-if="movies.length">
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, the `ng-if` directive removes or recreates a portion of the DOM
|
In Angular 1, the `ng-if` directive removes or recreates a portion of the DOM,
|
||||||
based on an expression. If the expression is false, the element is removed from the DOM.
|
based on an expression. If the expression is false, the element is removed from the DOM.
|
||||||
|
|
||||||
In this example, the `table` element is removed from the DOM unless the `movies` array has a length greater than zero.
|
In this example, the `table` element is removed from the DOM unless the `movies` array has a length greater than zero.
|
||||||
@ -288,13 +286,12 @@ table(width="100%")
|
|||||||
### *ngIf
|
### *ngIf
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'ngIf')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'ngIf')(format="." )
|
||||||
:marked
|
:marked
|
||||||
The `*ngIf` directive in Angular 2 works the same as the `ng-if` directive in Angular 1,
|
The `*ngIf` directive in Angular 2 works the same as the `ng-if` directive in Angular 1. It removes or recreates a portion of the DOM based on an expression.
|
||||||
it removes or recreates a portion of the DOM based on an expression.
|
|
||||||
|
|
||||||
In this example, the `table` element is removed from the DOM unless the `movies` array has a length.
|
In this example, the `table` element is removed from the DOM unless the `movies` array has a length.
|
||||||
|
|
||||||
The (*) before `ngIf` is required in this example.
|
The (*) before `ngIf` is required in this example.
|
||||||
For more information see [Structural Directives](../guide/structural-directives.html).
|
For more information, see [Structural Directives](../guide/structural-directives.html).
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -303,18 +300,16 @@ table(width="100%")
|
|||||||
<input ng-model="vm.favoriteHero"/>
|
<input ng-model="vm.favoriteHero"/>
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, the `ng-model` directive binds a form control to a property in the controller associated with the template.
|
In Angular 1, the `ng-model` directive binds a form control to a property in the controller associated with the template.
|
||||||
This provides **two-way binding** whereby any changes made to the value in the view is synchronized with the model and
|
This provides **two-way binding**, whereby any change made to the value in the view is synchronized with the model, and any change to the model is synchronized with the value in the view.
|
||||||
any changes to the model are synchronized with the value in the view.
|
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### ngModel
|
### ngModel
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'ngModel')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'ngModel')(format="." )
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, **two-way binding** is denoted with [()], descriptively referred to as a "banana in a box".
|
In Angular 2, **two-way binding** is denoted by `[()]`, descriptively referred to as a "banana in a box". This syntax is a shortcut for defining both property binding (from the component to the view)
|
||||||
This syntax is a short-cut for defining both property binding (from the component to the view)
|
and event binding (from the view to the component), thereby providing two-way binding.
|
||||||
and event binding (from the view to the component), thereby giving us two-way binding.
|
|
||||||
|
|
||||||
For more information on two-way binding with ngModel see [Template Syntax](../guide/template-syntax.html#ngModel).
|
For more information on two-way binding with ngModel, see [Template Syntax](../guide/template-syntax.html#ngModel).
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -323,16 +318,15 @@ table(width="100%")
|
|||||||
<tr ng-repeat="movie in vm.movies">
|
<tr ng-repeat="movie in vm.movies">
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, the `ng-repeat` directive repeats the associated DOM element
|
In Angular 1, the `ng-repeat` directive repeats the associated DOM element
|
||||||
for each item from the specified collection.
|
for each item in the specified collection.
|
||||||
|
|
||||||
In this example, the table row (`tr`) element is repeated for each movie object in the collection of movies.
|
In this example, the table row (`tr`) element repeats for each movie object in the collection of movies.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### *ngFor
|
### *ngFor
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'ngFor')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'ngFor')(format="." )
|
||||||
:marked
|
:marked
|
||||||
The `*ngFor` directive in Angular 2 is similar to the `ng-repeat` directive in Angular 1.
|
The `*ngFor` directive in Angular 2 is similar to the `ng-repeat` directive in Angular 1. It repeats the associated DOM element for each item in the specified collection.
|
||||||
It repeats the associated DOM element for each item from the specified collection.
|
|
||||||
More accurately, it turns the defined element (`tr` in this example) and its contents into a template and
|
More accurately, it turns the defined element (`tr` in this example) and its contents into a template and
|
||||||
uses that template to instantiate a view for each item in the list.
|
uses that template to instantiate a view for each item in the list.
|
||||||
|
|
||||||
@ -341,7 +335,7 @@ table(width="100%")
|
|||||||
the `let` keyword identifies `movie` as an input variable;
|
the `let` keyword identifies `movie` as an input variable;
|
||||||
the list preposition is `of`, not `in`.
|
the list preposition is `of`, not `in`.
|
||||||
|
|
||||||
For more information see [Structural Directives](../guide/structural-directives.html).
|
For more information, see [Structural Directives](../guide/structural-directives.html).
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -351,7 +345,7 @@ table(width="100%")
|
|||||||
Your favorite hero is: {{vm.favoriteHero}}
|
Your favorite hero is: {{vm.favoriteHero}}
|
||||||
</h3>
|
</h3>
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, the `ng-show` directive shows or hides the associated DOM element based on
|
In Angular 1, the `ng-show` directive shows or hides the associated DOM element, based on
|
||||||
an expression.
|
an expression.
|
||||||
|
|
||||||
In this example, the `div` element is shown if the `favoriteHero` variable is truthy.
|
In this example, the `div` element is shown if the `favoriteHero` variable is truthy.
|
||||||
@ -360,15 +354,15 @@ table(width="100%")
|
|||||||
### bind to the `hidden` property
|
### bind to the `hidden` property
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'hidden')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'hidden')(format="." )
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, we use property binding; there is no built-in *show* directive.
|
Angular 2, uses property binding; there is no built-in *show* directive.
|
||||||
For hiding and showing elements, we bind to the HTML `hidden` property.
|
For hiding and showing elements, bind to the HTML `hidden` property.
|
||||||
|
|
||||||
To conditionally display an element, place the element's `hidden` property in square brackets and
|
To conditionally display an element, place the element's `hidden` property in square brackets and
|
||||||
set it to a quoted template expression that evaluates to the *opposite* of *show*.
|
set it to a quoted template expression that evaluates to the *opposite* of *show*.
|
||||||
|
|
||||||
In this example, the `div` element is hidden if the `favoriteHero` variable is not truthy.
|
In this example, the `div` element is hidden if the `favoriteHero` variable is not truthy.
|
||||||
|
|
||||||
For more information on property binding see [Template Syntax](../guide/template-syntax.html#property-binding).
|
For more information on property binding, see [Template Syntax](../guide/template-syntax.html#property-binding).
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -376,7 +370,7 @@ table(width="100%")
|
|||||||
code-example(format="").
|
code-example(format="").
|
||||||
<img ng-src="{{movie.imageurl}}">
|
<img ng-src="{{movie.imageurl}}">
|
||||||
:marked
|
:marked
|
||||||
The `ng-src` directive allows Angular 1 to preprocess the `src` property so it
|
The `ng-src` directive allows Angular 1 to preprocess the `src` property so that it
|
||||||
can replace the binding expression with the appropriate URL before the browser
|
can replace the binding expression with the appropriate URL before the browser
|
||||||
fetches from that URL.
|
fetches from that URL.
|
||||||
td
|
td
|
||||||
@ -384,10 +378,10 @@ table(width="100%")
|
|||||||
### bind to the `src` property
|
### bind to the `src` property
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'src')(format="." )
|
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'src')(format="." )
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, we use property binding; there is no built-in *src* directive.
|
Angular 2, uses property binding; there is no built-in *src* directive.
|
||||||
We place the `src` property in square brackets and set it to a quoted template expression.
|
Place the `src` property in square brackets and set it to a quoted template expression.
|
||||||
|
|
||||||
For more information on property binding see [Template Syntax](../guide/template-syntax.html#property-binding).
|
For more information on property binding, see [Template Syntax](../guide/template-syntax.html#property-binding).
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -412,9 +406,9 @@ table(width="100%")
|
|||||||
|
|
||||||
Angular 2 also has **style binding**, which is good way to set a single style. This is shown in the second example.
|
Angular 2 also has **style binding**, which is good way to set a single style. This is shown in the second example.
|
||||||
|
|
||||||
For more information on style binding see [Template Syntax](../guide/template-syntax.html#style-binding).
|
For more information on style binding, see [Template Syntax](../guide/template-syntax.html#style-binding).
|
||||||
|
|
||||||
For more information on the ngStyle directive see [Template Syntax](../guide/template-syntax.html#ngStyle).
|
For more information on the ngStyle directive, see [Template Syntax](../guide/template-syntax.html#ngStyle).
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -437,7 +431,7 @@ table(width="100%")
|
|||||||
an element by selecting one of the templates based on the current value of an expression.
|
an element by selecting one of the templates based on the current value of an expression.
|
||||||
|
|
||||||
In this example, if `favoriteHero` is not set, the template displays "Please enter ...".
|
In this example, if `favoriteHero` is not set, the template displays "Please enter ...".
|
||||||
If the `favoriteHero` is set, it checks the movie hero by calling a controller method.
|
If `favoriteHero` is set, it checks the movie hero by calling a controller method.
|
||||||
If that method returns `true`, the template displays "Excellent choice!".
|
If that method returns `true`, the template displays "Excellent choice!".
|
||||||
If that methods returns `false`, the template displays "No movie, sorry!".
|
If that methods returns `false`, the template displays "No movie, sorry!".
|
||||||
td
|
td
|
||||||
@ -449,24 +443,24 @@ table(width="100%")
|
|||||||
It displays an element whose `*ngSwitchCase` matches the current `ngSwitch` expression value.
|
It displays an element whose `*ngSwitchCase` matches the current `ngSwitch` expression value.
|
||||||
|
|
||||||
In this example, if `favoriteHero` is not set, the `ngSwitch` value is `null`
|
In this example, if `favoriteHero` is not set, the `ngSwitch` value is `null`
|
||||||
and we see the `*ngSwitchDefault` paragraph, "Please enter ...".
|
and `*ngSwitchDefault` displays, "Please enter ...".
|
||||||
If the `favoriteHero` is set, it checks the movie hero by calling a component method.
|
If `favoriteHero` is set, the app checks the movie hero by calling a component method.
|
||||||
If that method returns `true`, we see "Excellent choice!".
|
If that method returns `true`, the app selects `*ngSwitchCase="true"` and displays: "Excellent choice!"
|
||||||
If that methods returns `false`, we see "No movie, sorry!".
|
If that methods returns `false`, the app selects `*ngSwitchCase="false"` and displays: "No movie, sorry!"
|
||||||
|
|
||||||
The (*) before `ngSwitchCase` and `ngSwitchDefault` is required in this example.
|
The (*) before `ngSwitchCase` and `ngSwitchDefault` is required in this example.
|
||||||
|
|
||||||
For more information on the ngSwitch directive see [Template Syntax](../guide/template-syntax.html#ngSwitch).
|
For more information on the ngSwitch directive, see [Template Syntax](../guide/template-syntax.html#ngSwitch).
|
||||||
:marked
|
:marked
|
||||||
[Back to top](#top)
|
[Back to top](#top)
|
||||||
|
|
||||||
a(id="filters-pipes")
|
a(id="filters-pipes")
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
## Filters / Pipes
|
## Filters/pipes
|
||||||
Angular 2 **pipes** provide formatting and transformation for data in our template, similar to Angular 1 **filters**.
|
Angular 2 **pipes** provide formatting and transformation for data in our template, similar to Angular 1 **filters**.
|
||||||
Many of the built-in filters in Angular 1 have corresponding pipes in Angular 2.
|
Many of the built-in filters in Angular 1 have corresponding pipes in Angular 2.
|
||||||
For more information on pipes see [Pipes](../guide/pipes.html).
|
For more information on pipes, see [Pipes](../guide/pipes.html).
|
||||||
|
|
||||||
table(width="100%")
|
table(width="100%")
|
||||||
col(width="50%")
|
col(width="50%")
|
||||||
@ -510,14 +504,11 @@ table(width="100%")
|
|||||||
code-example.
|
code-example.
|
||||||
<tr ng-repeat="movie in movieList | filter: {title:listFilter}">
|
<tr ng-repeat="movie in movieList | filter: {title:listFilter}">
|
||||||
:marked
|
:marked
|
||||||
Selects a subset of items from the defined collection based on the filter criteria.
|
Selects a subset of items from the defined collection, based on the filter criteria.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### none
|
### none
|
||||||
There is no comparable pipe in Angular 2 for performance reasons.
|
For performance reasons, no comparable pipe exists in Angular 2. Do all your filtering in the component. If you need the same filtering code in several templates, consider building a custom pipe.
|
||||||
Filtering should be coded in the component.
|
|
||||||
Consider building a custom pipe if the same filtering code
|
|
||||||
will be reused in several templates.
|
|
||||||
|
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
@ -547,10 +538,10 @@ table(width="100%")
|
|||||||
### slice
|
### slice
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'slice')(format=".")
|
+makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'slice')(format=".")
|
||||||
:marked
|
:marked
|
||||||
The `SlicePipe` does the same thing but the *order of the parameters is reversed* in keeping
|
The `SlicePipe` does the same thing but the *order of the parameters is reversed*, in keeping
|
||||||
with the JavaScript `Slice` method.
|
with the JavaScript `Slice` method.
|
||||||
The first parameter is the starting index; the second is the limit.
|
The first parameter is the starting index; the second is the limit.
|
||||||
As in Angular 1, performance may improve if we code this operation within the component instead.
|
As in Angular 1, coding this operation within the component instead could improve performance.
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -580,9 +571,9 @@ table(width="100%")
|
|||||||
:marked
|
:marked
|
||||||
The Angular 2 `number` pipe is similar.
|
The Angular 2 `number` pipe is similar.
|
||||||
It provides more functionality when defining
|
It provides more functionality when defining
|
||||||
the decimal places as shown in the second example above.
|
the decimal places, as shown in the second example above.
|
||||||
|
|
||||||
Angular 2 also has a `percent` pipe which formats a number as a local percentage
|
Angular 2 also has a `percent` pipe, which formats a number as a local percentage
|
||||||
as shown in the third example.
|
as shown in the third example.
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
@ -591,29 +582,27 @@ table(width="100%")
|
|||||||
code-example.
|
code-example.
|
||||||
<tr ng-repeat="movie in movieList | orderBy : 'title'">
|
<tr ng-repeat="movie in movieList | orderBy : 'title'">
|
||||||
:marked
|
:marked
|
||||||
Orders the collection as specified by the expression.
|
Displays the collection in the order specified by the expression.
|
||||||
In this example, the movieList is ordered by the movie title.
|
In this example, the movie title orders the movieList.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### none
|
### none
|
||||||
There is no comparable pipe in Angular 2 for performance reasons.
|
For performance reasons, no comparable pipe exists in Angular 2.
|
||||||
Ordering/sorting the results should be coded in the component.
|
Instead, use component code to order or sort results. If you need the same ordering or sorting code in several templates, consider building a custom pipe.
|
||||||
Consider building a custom pipe if the same ordering/sorting code
|
|
||||||
will be reused in several templates.
|
|
||||||
:marked
|
:marked
|
||||||
[Back to top](#top)
|
[Back to top](#top)
|
||||||
|
|
||||||
a(id="controllers-components")
|
a(id="controllers-components")
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
## Modules / Controllers / Components
|
## Modules/controllers/components
|
||||||
In both Angular 1 and Angular 2, we use Angular modules to
|
In both Angular 1 and Angular 2, Angular modules help you organize your application into cohesive blocks of functionality.
|
||||||
help us organize our application into cohesive blocks of functionality.
|
|
||||||
|
|
||||||
In Angular 1, we write the code that provides the model and the methods for the view in a **controller**.
|
In Angular 1, you write the code that provides the model and the methods for the view in a **controller**.
|
||||||
In Angular 2, we build a **component**.
|
In Angular 2, you build a **component**.
|
||||||
|
|
||||||
Because much of our Angular 1 code is in JavaScript, JavaScript code is shown in the Angular 1 column.
|
Because much Angular 1 code is in JavaScript, JavaScript code is shown in the Angular 1 column.
|
||||||
The Angular 2 code is shown using TypeScript.
|
The Angular 2 code is shown using TypeScript.
|
||||||
|
|
||||||
table(width="100%")
|
table(width="100%")
|
||||||
@ -631,15 +620,15 @@ table(width="100%")
|
|||||||
...
|
...
|
||||||
}());
|
}());
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, we often defined an immediately invoked function expression (or IIFE) around our controller code.
|
In Angular 1, you often defined an immediately invoked function expression (or IIFE) around your controller code.
|
||||||
This kept our controller code out of the global namespace.
|
This kept your controller code out of the global namespace.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### none
|
### none
|
||||||
We don't need to worry about this in Angular 2 because we use ES 2015 modules
|
You don't need to worry about this in Angular 2 because you use ES 2015 modules
|
||||||
and modules handle the namespacing for us.
|
and modules handle the namespacing for you.
|
||||||
|
|
||||||
For more information on modules see [Architecture Overview](../guide/architecture.html#module).
|
For more information on modules, see [Architecture Overview](../guide/architecture.html#module).
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -647,9 +636,7 @@ table(width="100%")
|
|||||||
code-example.
|
code-example.
|
||||||
angular.module("movieHunter", ["ngRoute"]);
|
angular.module("movieHunter", ["ngRoute"]);
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, we define an Angular module, which keeps track of our
|
In Angular 1, an Angular module keeps track of controllers, services, and other code. The second argument defines the list of other modules that this module depends upon.
|
||||||
controllers, services, and other code. The second argument defines the list
|
|
||||||
of other modules that this module depends upon.
|
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### Angular modules
|
### Angular modules
|
||||||
@ -657,9 +644,9 @@ table(width="100%")
|
|||||||
:marked
|
:marked
|
||||||
Angular 2 modules, defined with the `NgModule` decorator, serve the same purpose:
|
Angular 2 modules, defined with the `NgModule` decorator, serve the same purpose:
|
||||||
- `imports`: specifies the list of other modules that this module depends upon
|
- `imports`: specifies the list of other modules that this module depends upon
|
||||||
- `declaration`: keeps track of our components, pipes, and directives.
|
- `declaration`: keeps track of your components, pipes, and directives.
|
||||||
|
|
||||||
For more information on modules see [Angular Modules](../guide/ngmodule.html).
|
For more information on modules, see [Angular Modules](../guide/ngmodule.html).
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -671,7 +658,7 @@ table(width="100%")
|
|||||||
["movieService",
|
["movieService",
|
||||||
MovieListCtrl]);
|
MovieListCtrl]);
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, we have code in each controller that looks up an appropriate Angular module
|
Angular 1, has code in each controller that looks up an appropriate Angular module
|
||||||
and registers the controller with that module.
|
and registers the controller with that module.
|
||||||
|
|
||||||
The first argument is the controller name. The second argument defines the string names of
|
The first argument is the controller name. The second argument defines the string names of
|
||||||
@ -681,13 +668,13 @@ table(width="100%")
|
|||||||
### Component Decorator
|
### Component Decorator
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.ts', 'component')(format=".")
|
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.ts', 'component')(format=".")
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, we add a decorator to the component class to provide any required metadata.
|
Angular 2, adds a decorator to the component class to provide any required metadata.
|
||||||
The Component decorator declares that the class is a component and provides metadata about
|
The Component decorator declares that the class is a component and provides metadata about
|
||||||
that component, such as its selector (or tag) and its template.
|
that component such as its selector (or tag) and its template.
|
||||||
|
|
||||||
This is how we associate a template with code, which is defined in the component class.
|
This is how you associate a template with code, which is defined in the component class.
|
||||||
|
|
||||||
For more information on components see [Architecture Overview](../guide/architecture.html#component).
|
For more information, see the [Components](../guide/architecture.html#components) section of the Architecture Overview page.
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -696,18 +683,17 @@ table(width="100%")
|
|||||||
function MovieListCtrl(movieService) {
|
function MovieListCtrl(movieService) {
|
||||||
}
|
}
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, we write the code for the model and methods in a controller function.
|
In Angular 1, you write the code for the model and methods in a controller function.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### Component class
|
### Component class
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.ts', 'class')(format=".")
|
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.ts', 'class')(format=".")
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, we create a component class.
|
In Angular 2, you create a component class.
|
||||||
|
|
||||||
NOTE: If you are using TypeScript with Angular 1 then the only difference here is
|
NOTE: If you are using TypeScript with Angular 1, you must use the `export` keyword to export the component class.
|
||||||
that the component class must be exported using the `export` keyword.
|
|
||||||
|
|
||||||
For more information on components see [Architecture Overview](../guide/architecture.html#component).
|
For more information, see the [Components](../guide/architecture.html#components) section of the Architecture Overview page.
|
||||||
tr(style=top)
|
tr(style=top)
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
@ -717,34 +703,34 @@ table(width="100%")
|
|||||||
function MovieListCtrl(movieService) {
|
function MovieListCtrl(movieService) {
|
||||||
}
|
}
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, we pass in any dependencies as controller function arguments.
|
In Angular 1, you pass in any dependencies as controller function arguments.
|
||||||
In this example, we inject a `MovieService`.
|
This example injects a `MovieService`.
|
||||||
|
|
||||||
We also guard against minification problems by telling Angular explicitly
|
To guard against minification problems, tell Angular explicitly
|
||||||
that it should inject an instance of the `MovieService` in the first parameter.
|
that it should inject an instance of the `MovieService` in the first parameter.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### Dependency injection
|
### Dependency injection
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.ts', 'di')(format=".")
|
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.ts', 'di')(format=".")
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, we pass in dependencies as arguments to the component class constructor.
|
In Angular 2, you pass in dependencies as arguments to the component class constructor.
|
||||||
In this example, we inject a `MovieService`.
|
This example injects a `MovieService`.
|
||||||
The first parameter's TypeScript type tells Angular what to inject even after minification.
|
The first parameter's TypeScript type tells Angular what to inject, even after minification.
|
||||||
|
|
||||||
For more information on dependency injection see [Architecture Overview](../guide/architecture.html#dependency-injection).
|
For more information, see the [Dependency Injection](../guide/architecture.html#dependency-injection) section of the Architecture Overview.
|
||||||
:marked
|
:marked
|
||||||
[Back to top](#top)
|
[Back to top](#top)
|
||||||
|
|
||||||
a(id="style-sheets")
|
a(id="style-sheets")
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
## Style Sheets
|
## Style sheets
|
||||||
Style sheets give our application a nice look.
|
Style sheets give your application a nice look.
|
||||||
In Angular 1, we specify the style sheets for our entire application.
|
In Angular 1, you specify the style sheets for your entire application.
|
||||||
As the application grows over time, the styles for the many parts of the application
|
As the application grows over time, the styles for the many parts of the application
|
||||||
are merged, which can cause unexpected results.
|
merge, which can cause unexpected results.
|
||||||
In Angular 2, we can still define style sheets for our entire application. But now we can
|
In Angular 2, you can still define style sheets for your entire application. But now you can
|
||||||
also encapculate a style sheet within a specific component.
|
also encapsulate a style sheet within a specific component.
|
||||||
table(width="100%")
|
table(width="100%")
|
||||||
col(width="50%")
|
col(width="50%")
|
||||||
col(width="50%")
|
col(width="50%")
|
||||||
@ -758,22 +744,22 @@ table(width="100%")
|
|||||||
code-example.
|
code-example.
|
||||||
<link href="styles.css" rel="stylesheet" />
|
<link href="styles.css" rel="stylesheet" />
|
||||||
:marked
|
:marked
|
||||||
In Angular 1, we use a `link` tag in the head section of our `index.html` file
|
Angular 1, uses a `link` tag in the head section of the `index.html` file
|
||||||
to define the styles for our application.
|
to define the styles for the application.
|
||||||
td
|
td
|
||||||
:marked
|
:marked
|
||||||
### Link tag
|
### Link tag
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/index.html', 'style')(format=".")
|
+makeExample('cb-a1-a2-quick-reference/ts/index.html', 'style')(format=".")
|
||||||
:marked
|
:marked
|
||||||
In Angular 2, we can continue to use the link tag to define the styles for our application in the `index.html` file.
|
In Angular 2, you can continue to use the link tag to define the styles for your application in the `index.html` file.
|
||||||
But we can now also encapsulate styles for our components.
|
But now you can also encapsulate styles for your components.
|
||||||
:marked
|
:marked
|
||||||
### StyleUrls
|
### StyleUrls
|
||||||
In Angular 2, we can use the `styles` or `styleUrls` property of the `@Component` metadata to define
|
In Angular 2, you can use the `styles` or `styleUrls` property of the `@Component` metadata to define
|
||||||
a style sheet for a particular component.
|
a style sheet for a particular component.
|
||||||
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.ts', 'style-url')(format=".")
|
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.ts', 'style-url')(format=".")
|
||||||
:marked
|
:marked
|
||||||
This allows us to set appropriate styles for individual components that won’t leak into
|
This allows you to set appropriate styles for individual components that won’t leak into
|
||||||
other parts of the application.
|
other parts of the application.
|
||||||
:marked
|
:marked
|
||||||
[Back to top](#top)
|
[Back to top](#top)
|
||||||
|
@ -15,7 +15,7 @@ block includes
|
|||||||
Most Angular 2 terms are everyday English words
|
Most Angular 2 terms are everyday English words
|
||||||
with a specific meaning within the Angular system.
|
with a specific meaning within the Angular system.
|
||||||
|
|
||||||
We have gathered here the most prominent terms
|
This glossary lists the most prominent terms
|
||||||
and a few less familiar ones that have unusual or
|
and a few less familiar ones that have unusual or
|
||||||
unexpected definitions.
|
unexpected definitions.
|
||||||
|
|
||||||
@ -31,9 +31,9 @@ block includes
|
|||||||
## Ahead of Time (AOT) Compilation
|
## Ahead of Time (AOT) Compilation
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
Angular applications can be compiled by developers 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
|
||||||
@ -41,13 +41,12 @@ block includes
|
|||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
Helps us organize an application into cohesive blocks of functionality.
|
Helps us organize an application into cohesive blocks of functionality.
|
||||||
An Angular module identifies the components, directives, and pipes that are used by the application
|
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`.
|
||||||
|
|
||||||
See the [Angular Module](!{docsLatest}/guide/ngmodule.html) chapter for details and examples.
|
For details and examples, see the [Angular Module](!{docsLatest}/guide/ngmodule.html) page.
|
||||||
|
|
||||||
+ifDocsFor('ts|dart')
|
+ifDocsFor('ts|dart')
|
||||||
:marked
|
:marked
|
||||||
@ -65,8 +64,7 @@ block includes
|
|||||||
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.
|
||||||
|
|
||||||
The `ngClass` directive for adding and removing CSS class names is a good example of
|
A good example of an Attribute Directive is the `ngClass` directive for adding and removing CSS class names.
|
||||||
an Attribute Directive.
|
|
||||||
|
|
||||||
.l-main-section#B
|
.l-main-section#B
|
||||||
|
|
||||||
@ -75,7 +73,7 @@ block includes
|
|||||||
## Barrel
|
## Barrel
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A barrel is a way to *rollup exports* from several ES2015 modules into a single convenience ES2015 module.
|
A barrel is a way to *rollup exports* from several ES2015 modules into a single convenient ES2015 module.
|
||||||
The barrel itself is an ES2015 module file that re-exports *selected* exports of other ES2015 modules.
|
The barrel itself is an ES2015 module file that re-exports *selected* exports of other ES2015 modules.
|
||||||
|
|
||||||
Imagine three ES2015 modules in a `heroes` folder:
|
Imagine three ES2015 modules in a `heroes` folder:
|
||||||
@ -95,13 +93,13 @@ block includes
|
|||||||
import { Hero } from '../heroes/hero.model.ts';
|
import { Hero } from '../heroes/hero.model.ts';
|
||||||
import { HeroService } from '../heroes/hero.service.ts';
|
import { HeroService } from '../heroes/hero.service.ts';
|
||||||
:marked
|
:marked
|
||||||
We can add a barrel to the `heroes` folder (called `index` by convention) that exports all of these items:
|
You can add a barrel to the `heroes` folder (called `index`, by convention) that exports all of these items:
|
||||||
code-example.
|
code-example.
|
||||||
export * from './hero.model.ts'; // re-export all of its exports
|
export * from './hero.model.ts'; // re-export all of its exports
|
||||||
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 it needs from the barrel.
|
Now a consumer can import what they need 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
|
||||||
@ -113,7 +111,7 @@ block includes
|
|||||||
|
|
||||||
.alert.is-important
|
.alert.is-important
|
||||||
:marked
|
:marked
|
||||||
Note that you can often achieve this same goal using [Angular modules](#angular-module) instead.
|
Note that you can often achieve this using [Angular modules](#angular-module) instead.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Binding
|
## Binding
|
||||||
@ -123,7 +121,7 @@ block includes
|
|||||||
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" or "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.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
@ -131,11 +129,11 @@ block includes
|
|||||||
.l-sub-section
|
.l-sub-section
|
||||||
block bootstrap-defn-top
|
block bootstrap-defn-top
|
||||||
:marked
|
:marked
|
||||||
We 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`).
|
||||||
The bootstraping identifies an application's top level "root" [Component](#component), which is the first
|
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 the [QuickStart](!{docsLatest}/quickstart.html).
|
component that is loaded for the application. For more information, see [QuickStart](!{docsLatest}/quickstart.html).
|
||||||
:marked
|
:marked
|
||||||
One 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.
|
||||||
|
|
||||||
.l-main-section#C
|
.l-main-section#C
|
||||||
:marked
|
:marked
|
||||||
@ -143,12 +141,12 @@ 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 a lowercase letter_.
|
_except the first letter which is lowercase_.
|
||||||
|
|
||||||
Function, property, and method names are typically spelled in camelCase. Examples include: `square`, `firstName` and `getHeroes`.
|
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 we call [PascalCase](#pascalcase).
|
This form is also known as **lower camel case**, to distinguish it from **upper camel case** which is [PascalCase](#pascalcase).
|
||||||
When we write "camelCase" in this documentation we always mean *lower camel case*.
|
When you see "camelCase" in this documentation it always means *lower camel case*.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Component
|
## Component
|
||||||
@ -158,10 +156,10 @@ block includes
|
|||||||
to a [View](#view) and handling most of the view’s display
|
to a [View](#view) and handling most of the view’s display
|
||||||
and user-interaction logic.
|
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).
|
||||||
|
|
||||||
The developer applies 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
|
||||||
that Angular needs to create a component instance and render it with its template
|
that Angular needs to create a component instance and render it with its template
|
||||||
as a view.
|
as a view.
|
||||||
@ -188,28 +186,24 @@ block includes
|
|||||||
Applications display data values to a user and respond to user
|
Applications display data values to a user and respond to user
|
||||||
actions (clicks, touches, keystrokes).
|
actions (clicks, touches, keystrokes).
|
||||||
|
|
||||||
We could push application data values into HTML, attach
|
Instead of manually pushing application data values into HTML, attaching
|
||||||
event listeners, pull changed values from the screen, and
|
event listeners, pulling changed values from the screen, and
|
||||||
update application data values ... all by hand.
|
updating application data values, you can use data binding by declaring the relationship between an HTML widget and data source and let the
|
||||||
|
|
||||||
Or we could declare the relationship between an HTML widget
|
|
||||||
and an application data source ... and let a data binding
|
|
||||||
framework handle the details.
|
framework handle the details.
|
||||||
|
|
||||||
Data Binding is that second approach. Angular has a rich
|
Angular has a rich data binding framework with a variety of data binding
|
||||||
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:
|
The many forms of binding include:
|
||||||
* [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#ng-model).
|
||||||
|
|
||||||
Learn more about data binding in the
|
Read more about data binding in the
|
||||||
[Template Syntax](!{docsLatest}/guide/template-syntax.html#data-binding) chapter.
|
[Template Syntax](!{docsLatest}/guide/template-syntax.html#data-binding) chapter.
|
||||||
|
|
||||||
+ifDocsFor('ts|dart')
|
+ifDocsFor('ts|dart')
|
||||||
@ -224,14 +218,12 @@ block includes
|
|||||||
|
|
||||||
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).
|
||||||
|
|
||||||
We apply a decorator by positioning it
|
To apply a decorator, position it immediately above or to the left of the thing it decorates.
|
||||||
immediately above or to the left of the thing it decorates.
|
|
||||||
|
|
||||||
Angular has its own set of decorators to help it interoperate with our 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 a property
|
class as an Angular [Component](#component) and an `@Input` decorator applied to the `name` property
|
||||||
of that component.
|
of that component. The elided object argument to the `@Component` decorator would contain the pertinent component metadata.
|
||||||
The elided object argument to the `@Component` decorator would contain the pertinent component metadata.
|
|
||||||
```
|
```
|
||||||
@Component({...})
|
@Component({...})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
@ -245,8 +237,7 @@ block includes
|
|||||||
|
|
||||||
.alert.is-important
|
.alert.is-important
|
||||||
:marked
|
:marked
|
||||||
Always include the parentheses `()` when applying a decorator.
|
Always include parentheses `()` when applying a decorator.
|
||||||
A decorator is a **function** that must be called when applied.
|
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Dependency Injection
|
## Dependency Injection
|
||||||
@ -257,14 +248,14 @@ block includes
|
|||||||
parts of an application that request them.
|
parts of an application that request them.
|
||||||
|
|
||||||
Angular developers prefer to build applications by defining many simple parts
|
Angular developers prefer to build applications by defining many simple parts
|
||||||
that each do one thing well and then wire them together at runtime.
|
that each do one thing well and then wiring them together at runtime.
|
||||||
|
|
||||||
These parts often rely on other parts. An Angular [Component](#component)
|
These parts often rely on other parts. An Angular [component](#component)
|
||||||
part might rely on a service part to get data or perform a calculation. When a
|
part might rely on a service part to get data or perform a calculation. When
|
||||||
part "A" relies on another part "B", we 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".
|
||||||
|
|
||||||
We 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".
|
||||||
@ -277,13 +268,12 @@ block includes
|
|||||||
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`). We rarely deal with tokens directly; most
|
A token is an Angular type (`OpaqueToken`). You rarely deal with tokens directly; most
|
||||||
methods accept a class name (`Foo`) or a string ("foo") and Angular converts it
|
methods accept a class name (`Foo`) or a string ("foo") and Angular converts it
|
||||||
to a token. When we 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.
|
||||||
|
|
||||||
Angular makes similar requests internally during many of its operations
|
During many of its operations, Angular makes similar requests internally, such as when it creates a [`Component`](#component) for display.
|
||||||
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
|
||||||
@ -299,23 +289,23 @@ block includes
|
|||||||
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) chapter.
|
Learn more in the [Dependency Injection](!{docsLatest}/guide/dependency-injection.html) page.
|
||||||
:marked
|
:marked
|
||||||
## Directive
|
## Directive
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
An Angular class responsible for creating, re-shaping, and interacting with HTML elements
|
An Angular class responsible for creating, reshaping, and interacting with HTML elements
|
||||||
in the browser DOM. Directives are Angular's most fundamental feature.
|
in the browser DOM. Directives are Angular's most fundamental feature.
|
||||||
|
|
||||||
A Directive is almost always associated with an HTML element or attribute.
|
A Directive is almost always associated with an HTML element or attribute.
|
||||||
We often refer to such an element or attribute as the directive itself.
|
We often refer to such an element or attribute as the directive itself.
|
||||||
When Angular finds a directive in an HTML template,
|
When Angular finds a directive in an HTML template,
|
||||||
it creates the matching directive class instance
|
it creates the matching directive class instance
|
||||||
and gives that instance control over that portion of the browser DOM.
|
and gives the instance control over that portion of the browser DOM.
|
||||||
|
|
||||||
Developers can invent custom HTML markup (e.g., `<my-directive>`) to
|
You can invent custom HTML markup (e.g., `<my-directive>`) to
|
||||||
associate with their custom directives. They add this custom markup to HTML templates
|
associate with your custom directives. You add this custom markup to HTML templates
|
||||||
as if they 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.
|
||||||
|
|
||||||
Directives fall into one of three categories:
|
Directives fall into one of three categories:
|
||||||
@ -330,7 +320,7 @@ block includes
|
|||||||
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 re-shaping 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.
|
||||||
|
|
||||||
.l-main-section#E
|
.l-main-section#E
|
||||||
@ -343,9 +333,9 @@ block includes
|
|||||||
|
|
||||||
The latest approved version of JavaScript is
|
The latest approved version of JavaScript is
|
||||||
[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 will 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](#typesScript).
|
||||||
|
|
||||||
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)"
|
||||||
@ -391,7 +381,7 @@ a#H
|
|||||||
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) chapter.
|
See the [Template Syntax](!{docsLatest}/guide/template-syntax.html#inputs-outputs) page.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Interpolation
|
## Interpolation
|
||||||
@ -401,14 +391,14 @@ a#H
|
|||||||
[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
|
||||||
or displayed between element tags as in this example.
|
or displayed between element tags, as in this example.
|
||||||
|
|
||||||
code-example(language="html" escape="html").
|
code-example(language="html" escape="html").
|
||||||
<label>My current hero is {{hero.name}}</label>
|
<label>My current hero is {{hero.name}}</label>
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
Learn more about interpolation in the
|
Read more about interpolation in the
|
||||||
[Template Syntax](!{docsLatest}/guide/template-syntax.html#interpolation) chapter.
|
[Template Syntax](!{docsLatest}/guide/template-syntax.html#interpolation) page.
|
||||||
|
|
||||||
.l-main-section#J
|
.l-main-section#J
|
||||||
|
|
||||||
@ -420,7 +410,7 @@ a#H
|
|||||||
: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 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
|
||||||
@ -435,25 +425,25 @@ a#H
|
|||||||
.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.
|
||||||
|
|
||||||
Developers 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 names `ngOnInit`.
|
For example, the `OnInit` interface has a hook method named `ngOnInit`.
|
||||||
|
|
||||||
Angular calls these hook methods in the following order:
|
Angular calls these hook methods in the following order:
|
||||||
* `ngOnChanges` - called when an [input](#input)/[output](#output) binding values change
|
* `ngOnChanges` - when an [input](#input)/[output](#output) binding value changes.
|
||||||
* `ngOnInit` - after the first `ngOnChanges`
|
* `ngOnInit` - after the first `ngOnChanges`.
|
||||||
* `ngDoCheck` - developer's custom change detection
|
* `ngDoCheck` - developer's custom change detection.
|
||||||
* `ngAfterContentInit` - after component content initialized
|
* `ngAfterContentInit` - after component content initialized.
|
||||||
* `ngAfterContentChecked` - after every check of component content
|
* `ngAfterContentChecked` - after every check of component content.
|
||||||
* `ngAfterViewInit` - after component's view(s) are initialized
|
* `ngAfterViewInit` - after component's view(s) are initialized.
|
||||||
* `ngAfterViewChecked` - after every check of a component's view(s)
|
* `ngAfterViewChecked` - after every check of a component's view(s).
|
||||||
* `ngOnDestroy` - just before the directive is destroyed.
|
* `ngOnDestroy` - just before the directive is destroyed.
|
||||||
|
|
||||||
Learn more in the [Lifecycle Hooks](!{docsLatest}/guide/lifecycle-hooks.html) chapter.
|
Read more in the [Lifecycle Hooks](!{docsLatest}/guide/lifecycle-hooks.html) page.
|
||||||
|
|
||||||
.l-main-section#M
|
.l-main-section#M
|
||||||
|
|
||||||
@ -465,14 +455,13 @@ 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).
|
||||||
See the [Angular Module](!{docsLatest}/guide/ngmodule.html) chapter for details and examples.
|
For details and examples, see the [Angular Module](!{docsLatest}/guide/ngmodule.html) page.
|
||||||
- ES2015 modules as described in this section.
|
- ES2015 modules, as described in this section.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
Angular apps are modular.
|
Angular apps are modular.
|
||||||
|
|
||||||
In general, we assemble our application from many modules, both the ones we write ourselves
|
In general, you assemble your application from many modules, both the ones you write and the ones you acquire from others.
|
||||||
and the ones we acquire from others.
|
|
||||||
|
|
||||||
A typical module is a cohesive block of code dedicated to a single purpose.
|
A typical module is a cohesive block of code dedicated to a single purpose.
|
||||||
|
|
||||||
@ -480,21 +469,19 @@ a#H
|
|||||||
A module that needs that thing, **imports** it.
|
A module that needs that thing, **imports** it.
|
||||||
|
|
||||||
The structure of Angular modules and the import/export syntax
|
The structure of Angular modules and the import/export syntax
|
||||||
is based on the [ES2015](#es2015) module standard
|
is based on the [ES2015 module standard](http://www.2ality.com/2014/09/es6-modules-final.html).
|
||||||
described [here](http://www.2ality.com/2014/09/es6-modules-final.html).
|
|
||||||
|
|
||||||
An application that adheres to this standard requires a module loader to
|
An application that adheres to this standard requires a module loader to
|
||||||
load modules on request and resolve inter-module dependencies.
|
load modules on request, and resolve inter-module dependencies.
|
||||||
Angular does not ship with a module loader and does not have a preference
|
Angular does not ship with a module loader and does not have a preference
|
||||||
for any particular 3rd party library (although most samples use SystemJS).
|
for any particular 3rd party library (although most examples use SystemJS).
|
||||||
Application developers may pick any module library that conforms to the standard
|
You may pick any module library that conforms to the standard.
|
||||||
|
|
||||||
Modules are typically named after the file in which the exported thing is defined.
|
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)
|
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`.
|
class belongs to a feature module named `date_pipe` in the file `date_pipe.ts`.
|
||||||
|
|
||||||
Developers rarely access Angular feature modules directly.
|
You rarely access Angular feature modules directly. You usually import them from one of the Angular [scoped packages](#scoped-package) such as `@angular/core`.
|
||||||
We usually import them from one of the Angular [scoped packages](#scoped-package) such as `@angular/core`.
|
|
||||||
|
|
||||||
a#N
|
a#N
|
||||||
.l-main-section#O
|
.l-main-section#O
|
||||||
@ -504,8 +491,8 @@ a#N
|
|||||||
## Observable
|
## Observable
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
We can think of an observable as an array whose items arrive asynchronously over time.
|
You can think of an observable as an array whose items arrive asynchronously over time.
|
||||||
Observables help us manage asynchronous data, such as data coming from a backend service.
|
Observables help you manage asynchronous data, such as data coming from a backend service.
|
||||||
Observables are used within Angular itself, including Angular's event system and its http client service.
|
Observables are used within Angular itself, including Angular's event system and its http client service.
|
||||||
|
|
||||||
To use observables, Angular uses a third-party library called Reactive Extensions (RxJS).
|
To use observables, Angular uses a third-party library called Reactive Extensions (RxJS).
|
||||||
@ -520,7 +507,7 @@ a#N
|
|||||||
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) chapter.
|
See the [Template Syntax](!{docsLatest}/guide/template-syntax.html#inputs-outputs) page.
|
||||||
|
|
||||||
.l-main-section#P
|
.l-main-section#P
|
||||||
|
|
||||||
@ -528,10 +515,9 @@ a#N
|
|||||||
## PascalCase
|
## PascalCase
|
||||||
.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 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`.
|
||||||
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 we simply call [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
|
||||||
@ -539,9 +525,9 @@ a#N
|
|||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
An Angular pipe is a function that transforms input values to output values for
|
An Angular pipe is a function that transforms input values to output values for
|
||||||
display in a [view](#view). We use the `!{_at}Pipe` !{_decoratorLink}
|
display in a [view](#view). Use the `!{_at}Pipe` !{_decoratorLink}
|
||||||
to associate the pipe function with a name. We can then use that
|
to associate the pipe function with a name. You then use that
|
||||||
name in our HTML to declaratively transform values on screen.
|
name in your HTML to declaratively transform values on screen.
|
||||||
|
|
||||||
Here's an example that uses the built-in `currency` pipe to display
|
Here's an example that uses the built-in `currency` pipe to display
|
||||||
a numeric value in the local currency.
|
a numeric value in the local currency.
|
||||||
@ -549,7 +535,7 @@ a#N
|
|||||||
code-example(language="html" escape="html").
|
code-example(language="html" escape="html").
|
||||||
<label>Price: </label>{{product.price | currency}}
|
<label>Price: </label>{{product.price | currency}}
|
||||||
:marked
|
:marked
|
||||||
Learn more in the chapter on [pipes](!{docsLatest}/guide/pipes.html) .
|
Read more in the page on [pipes](!{docsLatest}/guide/pipes.html).
|
||||||
|
|
||||||
- var _ProviderUrl = docsLatest+'/api/'+(lang == 'dart' ? 'angular2.core' : 'core/index')+'/Provider-class.html'
|
- var _ProviderUrl = docsLatest+'/api/'+(lang == 'dart' ? 'angular2.core' : 'core/index')+'/Provider-class.html'
|
||||||
:marked
|
:marked
|
||||||
@ -558,8 +544,7 @@ a#N
|
|||||||
: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" —
|
It relates a lookup token to code—sometimes called a "recipe"—that can create a dependency value.
|
||||||
that can create a dependency value.
|
|
||||||
|
|
||||||
a#Q
|
a#Q
|
||||||
.l-main-section#R
|
.l-main-section#R
|
||||||
@ -578,24 +563,22 @@ a#Q
|
|||||||
- The template input elements do *not* use `ngModel`.
|
- The template input elements do *not* use `ngModel`.
|
||||||
- The associated Angular directives are all prefixed with `Form` such as `FormGroup`, `FormControl`, and `FormControlName`.
|
- The associated Angular directives are all prefixed with `Form` such as `FormGroup`, `FormControl`, and `FormControlName`.
|
||||||
|
|
||||||
Reactive forms are powerful, flexible, and great for more complex data entry form scenarios, such as dynamic generation
|
Reactive forms are powerful, flexible, and great for more complex data entry form scenarios such as dynamic generation of form controls.
|
||||||
of form controls.
|
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Router
|
## Router
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
Most applications consist of many screens or [views](#view).
|
Most applications consist of many screens or [views](#view).
|
||||||
The user navigates among them by clicking links and buttons
|
The user navigates among them by clicking links and buttons,
|
||||||
and taking 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
|
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
|
||||||
and managing the entire view navigation process including the creation and destruction
|
|
||||||
of views.
|
of views.
|
||||||
+ifDocsFor('ts|js')
|
+ifDocsFor('ts|js')
|
||||||
:marked
|
:marked
|
||||||
In most cases, components becomes attached to a [router](#router) by means
|
In most cases, components become attached to a [router](#router) by means
|
||||||
of a `RouterConfig` that defines routes to views.
|
of a `RouterConfig` that defines routes to views.
|
||||||
|
|
||||||
A [routing component's](#routing-component) template has a `RouterOutlet` element
|
A [routing component's](#routing-component) template has a `RouterOutlet` element
|
||||||
@ -604,7 +587,7 @@ 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.
|
||||||
|
|
||||||
See the [Component Router](!{docsLatest}/guide/router.html) chapter to learn more.
|
For more information, see the [Component Router](!{docsLatest}/guide/router.html) page.
|
||||||
|
|
||||||
+ifDocsFor('ts|js')
|
+ifDocsFor('ts|js')
|
||||||
:marked
|
:marked
|
||||||
@ -613,7 +596,7 @@ a#Q
|
|||||||
: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.
|
||||||
|
|
||||||
See the [Component Router](!{docsLatest}/guide/router.html) chapter to learn more.
|
For more information, see the [Component Router](!{docsLatest}/guide/router.html) page.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Routing Component
|
## Routing Component
|
||||||
@ -622,7 +605,7 @@ a#Q
|
|||||||
: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.
|
||||||
|
|
||||||
See the [Component Router](!{docsLatest}/guide/router.html) chapter to learn more.
|
For more information, see the [Component Router](!{docsLatest}/guide/router.html) page.
|
||||||
|
|
||||||
.l-main-section#S
|
.l-main-section#S
|
||||||
|
|
||||||
@ -636,9 +619,9 @@ a#Q
|
|||||||
|
|
||||||
A [*scoped package*](https://docs.npmjs.com/misc/scope) is a way to group related *npm* packages.
|
A [*scoped package*](https://docs.npmjs.com/misc/scope) is a way to group related *npm* packages.
|
||||||
|
|
||||||
We import a scoped package the same way we'd import a *normal* package.
|
You import a scoped package the same way that you'd import a *normal* package.
|
||||||
The only difference, from a consumer perspective,
|
The only difference, from a consumer perspective,
|
||||||
is that the package name begins with the Angular *scope name*, `@angular`.
|
is that the *scoped package* name begins with the Angular *scope name*, `@angular`.
|
||||||
|
|
||||||
+makeExcerpt('architecture/ts/app/app.component.ts', 'import', '')
|
+makeExcerpt('architecture/ts/app/app.component.ts', 'import', '')
|
||||||
|
|
||||||
@ -649,38 +632,34 @@ a#snake-case
|
|||||||
.l-sub-section
|
.l-sub-section
|
||||||
block snake-case-defn
|
block snake-case-defn
|
||||||
:marked
|
:marked
|
||||||
The practice of writing compound words or phrases such that each word is separated by an
|
The practice of writing compound words or phrases such that an
|
||||||
underscore (`_`). This form is also known as **underscore case**.
|
underscore (`_`) separates one word from the next. This form is also known as **underscore case**.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Service
|
## Service
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
Components are great and all, but what do we do with data or logic that are not associated
|
For data or logic that is not associated
|
||||||
with a specific view or that we want to share across components? We build services!
|
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.
|
Applications often require services such as a hero data service or a logging service.
|
||||||
Our components depend on these services to do the heavy lifting.
|
|
||||||
|
|
||||||
A service is a class with a focused purpose.
|
A service is a class with a focused purpose.
|
||||||
We often create a service to implement features that are
|
We often create a service to implement features that are
|
||||||
independent from any specific view,
|
independent from any specific view,
|
||||||
provide share data or logic across components, or encapsulate external interactions.
|
provide shared data or logic across components, or encapsulate external interactions.
|
||||||
|
|
||||||
See the [Services](!{docsLatest}/tutorial/toh-pt4.html) chapter of the tutorial to learn more.
|
For more information, see the [Services](!{docsLatest}/tutorial/toh-pt4.html) page.
|
||||||
|
|
||||||
: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 re-shape HTML layout, typically by adding, removing, or manipulating
|
shape or reshape HTML layout, typically by adding, removing, or manipulating
|
||||||
elements and their children.
|
elements and their children; for example, the `ngIf` "conditional element" directive and the `ngFor` "repeater" directive.
|
||||||
|
|
||||||
The `ngIf` "conditional element" directive and the `ngFor` "repeater" directive are
|
Read more in the [Structural Directives](!{docsLatest}/guide/structural-directives.html) page.
|
||||||
good examples in this category.
|
|
||||||
|
|
||||||
See the [Structural Directives](!{docsLatest}/guide/structural-directives.html) chapter to learn more.
|
|
||||||
|
|
||||||
.l-main-section#T
|
.l-main-section#T
|
||||||
:marked
|
:marked
|
||||||
@ -691,7 +670,6 @@ a#snake-case
|
|||||||
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).
|
||||||
|
|
||||||
We write templates in a special [Template Syntax](!{docsLatest}/guide/template-syntax.html).
|
|
||||||
|
|
||||||
+ifDocsFor('ts|js')
|
+ifDocsFor('ts|js')
|
||||||
:marked
|
:marked
|
||||||
@ -704,11 +682,10 @@ 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 that has a `name` attribute and
|
- 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.
|
||||||
two-way binding set up.
|
|
||||||
- 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 and 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
|
Learn how to build template-driven forms
|
||||||
in the [Forms](!{docsLatest}/guide/forms.html) chapter.
|
in the [Forms](!{docsLatest}/guide/forms.html) chapter.
|
||||||
@ -718,33 +695,34 @@ a#snake-case
|
|||||||
.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). Learn how to write template expressions
|
a [data binding](#data-binding).
|
||||||
in the [Template Syntax](!{docsLatest}/guide/template-syntax.html#template-expressions) chapter.
|
|
||||||
|
Read about how to write template expressions
|
||||||
|
in the [Template Syntax](!{docsLatest}/guide/template-syntax.html#template-expressions) page.
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## Transpile
|
## Transpile
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
The process of transforming code written in one form of JavaScript
|
The process of transforming code written in one form of JavaScript
|
||||||
(e.g., TypeScript) into another form of JavaScript (e.g., [ES5](#es5)).
|
(for example, TypeScript) into another form of JavaScript (for example, [ES5](#es5)).
|
||||||
|
|
||||||
:marked
|
:marked
|
||||||
## TypeScript
|
## TypeScript
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
A version of JavaScript that supports most [ECMAScript](#ecmascript) 2015
|
A version of JavaScript that supports most [ECMAScript 2015](#ecmascript=2015)
|
||||||
language features and many features that may arrive in future versions
|
language features such as [Decorators](#decorator).
|
||||||
of JavaScript 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 (e.g. "intellisense",
|
us compile-time type checking and strong tooling support (for example, "intellisense",
|
||||||
code completion, refactoring, and intelligent search). Many code editors
|
code completion, refactoring, and intelligent search). Many code editors
|
||||||
and IDEs support TypeScript either natively or with plugins.
|
and IDEs support TypeScript either natively or with plugins.
|
||||||
|
|
||||||
TypeScript is the preferred language for Angular 2 development although
|
TypeScript is the preferred language for Angular 2 development although
|
||||||
we are welcome to write in other JavaScript dialects such as [ES5](#es5).
|
you can use other JavaScript dialects such as [ES5](#es5).
|
||||||
|
|
||||||
Learn more about TypeScript on its [website](http://www.typescriptlang.org/).
|
Read more about TypeScript on its [website](http://www.typescriptlang.org/).
|
||||||
|
|
||||||
a#U
|
a#U
|
||||||
.l-main-section#V
|
.l-main-section#V
|
||||||
@ -758,8 +736,8 @@ a#U
|
|||||||
|
|
||||||
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 we often
|
The Component plays such a prominent role that it's often
|
||||||
find it 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
|
||||||
dynamically as the user navigates through the application, typically
|
dynamically as the user navigates through the application, typically
|
||||||
@ -779,16 +757,16 @@ a#Y
|
|||||||
a JavaScript application's asynchronous activity.
|
a JavaScript application's asynchronous activity.
|
||||||
|
|
||||||
The browser DOM and JavaScript have a limited number
|
The browser DOM and JavaScript have a limited number
|
||||||
of asynchronous activities, activities such as DOM events (e.g., clicks),
|
of asynchronous activities, activities such as DOM events (for example, clicks),
|
||||||
[promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), and
|
[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)
|
[XHR](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)
|
||||||
calls to remote servers.
|
calls to remote servers.
|
||||||
|
|
||||||
Zones intercept all of these activities and give a "zone client" the opportunity
|
Zones intercept all of these activities and give a "zone client" the opportunity
|
||||||
to take action before and after the async activity completes.
|
to take action before and after the async activity finishes.
|
||||||
|
|
||||||
Angular runs our application in a zone where it can respond to
|
Angular runs your application in a zone where it can respond to
|
||||||
asynchronous events by checking for data changes and updating
|
asynchronous events by checking for data changes, and updating
|
||||||
the information it displays via [data bindings](#data-binding).
|
the information it displays via [data bindings](#data-binding).
|
||||||
|
|
||||||
Learn more about zones in this
|
Learn more about zones in this
|
||||||
|
@ -154,6 +154,7 @@ figure
|
|||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
<a id="components"></a>
|
||||||
## Components
|
## Components
|
||||||
figure
|
figure
|
||||||
img(src="/resources/images/devguide/architecture/hero-component.png" alt="Component" align="left" style="width:200px; margin-left:-40px;margin-right:10px" )
|
img(src="/resources/images/devguide/architecture/hero-component.png" alt="Component" align="left" style="width:200px; margin-left:-40px;margin-right:10px" )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user