Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit cb09c82

Browse files
docs(toh): resolve conflicts, edit copy
1 parent e8cb28d commit cb09c82

File tree

9 files changed

+167
-266
lines changed

9 files changed

+167
-266
lines changed

public/docs/_examples/toh-3/ts/src/app/hero-detail.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Component, Input } from '@angular/core';
44
// #enddocregion import-input
55

66
import { Hero } from './hero';
7-
7+
// #docregion template
88
@Component({
99
selector: 'hero-detail',
1010
template: `
@@ -18,6 +18,7 @@ import { Hero } from './hero';
1818
</div>
1919
`
2020
})
21+
// #enddocregion template
2122
// #docregion class
2223
export class HeroDetailComponent {
2324
// #docregion hero

public/docs/_examples/toh-5/ts/src/app/hero-detail.component.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ import { Hero } from './hero';
1010
import { HeroService } from './hero.service';
1111
// #docregion metadata
1212
@Component({
13-
<<<<<<< HEAD:public/docs/_examples/toh-5/ts/src/app/hero-detail.component.ts
14-
selector: 'my-hero-detail',
15-
=======
16-
moduleId: module.id,
1713
selector: 'hero-detail',
18-
>>>>>>> docs(toh-3): heavy copy edit; my-hero-detail -> hero-detail:public/docs/_examples/toh-5/ts/app/hero-detail.component.ts
1914
templateUrl: './hero-detail.component.html',
2015
// #enddocregion metadata, v2
2116
styleUrls: [ './hero-detail.component.css' ]

public/docs/_examples/toh-6/ts/src/app/hero-detail.component.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ import { Hero } from './hero';
88
import { HeroService } from './hero.service';
99

1010
@Component({
11-
<<<<<<< HEAD:public/docs/_examples/toh-6/ts/src/app/hero-detail.component.ts
12-
selector: 'my-hero-detail',
13-
=======
14-
moduleId: module.id,
1511
selector: 'hero-detail',
16-
>>>>>>> docs(toh-3): heavy copy edit; my-hero-detail -> hero-detail:public/docs/_examples/toh-6/ts/app/hero-detail.component.ts
1712
templateUrl: './hero-detail.component.html',
1813
styleUrls: [ './hero-detail.component.css' ]
1914
})

public/docs/ts/latest/tutorial/toh-pt1.jade

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ include ../_util-fns
44
## Setup to develop locally
55
Follow the [setup](../guide/setup.html) instructions for creating a new project
66
named <ngio-ex path="angular-tour-of-heroes"></ngio-ex>.
7-
<!-- CF: TO DO: Ward commented: if you only followed the current setup instructions, there would be many more files.
8-
I just added a section to the Setup guide for deleting non-essential files. We should refer to that too.
9-
See #3079 which will merge soon. The link to it would be:
10-
[_Deleting non-essential files_](../guide/setup.html#non-essential "Setup: Deleting non-essential files") -->
7+
118
The file structure should look like this:
129

1310
.filetree
@@ -24,7 +21,7 @@ include ../_util-fns
2421
.file styles.css
2522
.file systemjs.config.js
2623
.file tsconfig.json
27-
.file node_modules ...
24+
.file node_modules ...
2825
.file package.json
2926
:marked
3027
When you're done with this page, the app should look like this <live-example></live-example>.
@@ -40,7 +37,7 @@ code-example(language="sh" class="code-shell").
4037
:marked
4138
This command runs the TypeScript compiler in "watch mode", recompiling automatically when the code changes.
4239
The command simultaneously launches the app in a browser and refreshes the browser when the code changes.
43-
40+
4441
You can keep building the Tour of Heroes without pausing to recompile or refresh the browser.
4542

4643
.l-main-section
@@ -52,7 +49,7 @@ code-example(language="sh" class="code-shell").
5249
+makeExample('toh-1/ts/app/app.component.1.ts', 'app-component-1', 'app.component.ts (AppComponent class)')(format=".")
5350

5451
:marked
55-
Now update the template in the `@Component` decoration with data bindings to these new properties.
52+
Now update the template in the `@Component` decorator with data bindings to these new properties.
5653

5754
+makeExample('toh-1/ts/app/app.component.1.ts', 'show-hero', 'app.component.ts (@Component)')(format='.')
5855

@@ -80,7 +77,7 @@ code-example(language="sh" class="code-shell").
8077

8178
:marked
8279
In the `Hero` class, refactor the component's `hero` property to be of type `Hero`,
83-
then initialize it with an id of `1` and the name `Windstorm`.
80+
then initialize it with an `id` of `1` and the name `Windstorm`.
8481

8582
+makeExample('toh-1/ts/src/app/app.component.ts', 'hero-property-1', 'src/app/app.component.ts (hero property)')(format=".")
8683

@@ -98,8 +95,8 @@ code-example(language="sh" class="code-shell").
9895
add a `<div>` for the hero's `id` property and another `<div>` for the hero's `name`.
9996
To keep the template readable, place each `<div>` on its own line.
10097

101-
The backticks around the component template let you put the `<h1>`, `<h2>`, and `<div>` elements on their own lines,
102-
thanks to the <i>template literals</i> feature in ES2015 and TypeScript. For more information, see
98+
The backticks around the component template let you put the `<h1>`, `<h2>`, and `<div>` elements on their own lines,
99+
thanks to the <i>template literals</i> feature in ES2015 and TypeScript. For more information, see
103100
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals" target="_blank" title="template literal">Template literals</a>.
104101

105102

@@ -122,13 +119,13 @@ code-example(language="sh" class="code-shell").
122119

123120
:marked
124121
`[(ngModel)]` is the Angular syntax to bind the `hero.name` property
125-
to the textbox.
122+
to the textbox.
126123
Data flow _in both directions_: from the property to the textbox;
127124
and from the textbox back to the property.
128125

129126
Unfortunately, immediately after this change, the application breaks.
130127
If you looked in the browser console, you'd see Angular complaining that
131-
" 'ngModel' ... isn't a known property of 'input'."
128+
"`ngModel` ... isn't a known property of `input`."
132129

133130
Although `NgModel` is a valid Angular directive, it isn't available by default.
134131
It belongs to the optional `FormsModule`.
@@ -137,18 +134,18 @@ code-example(language="sh" class="code-shell").
137134
### Import the _FormsModule_
138135

139136
Open the `app.module.ts` file and import the `FormsModule` symbol from the `@angular/forms` library.
140-
Then add the `FormsModule` to the `NgModule` metadata's `imports` array, which contains the list
137+
Then add the `FormsModule` to the `@NgModule` metadata's `imports` array, which contains the list
141138
of external modules that the app uses.
142-
139+
143140
The updated `AppModule` looks like this:
144-
+makeExample('toh-1/ts/app/app.module.ts', '', 'app.module.ts (FormsModule import)')
141+
+makeExample('toh-1/ts/src/app/app.module.ts', '', 'app.module.ts (FormsModule import)')
145142

146143
.l-sub-section
147144
:marked
148145
Read more about `FormsModule` and `ngModel` in the
149-
[_Two-way data binding with ngModel_](../guide/forms.html#ngModel) section of the
146+
[Two-way data binding with ngModel](../guide/forms.html#ngModel) section of the
150147
[Forms](../guide/forms.html) guide and the
151-
[_Two-way binding with NgModel_](../guide/template-syntax.html#ngModel) section of the
148+
[Two-way binding with NgModel](../guide/template-syntax.html#ngModel) section of the
152149
[Template Syntax](../guide/template-syntax.html) guide.
153150

154151
:marked
@@ -171,7 +168,7 @@ code-example(language="sh" class="code-shell").
171168

172169
Here's the complete `app.component.ts` as it stands now:
173170

174-
+makeExample('toh-1/ts/src/app/app.component.ts', 'pt1', 'src/app/app.component.ts')
171+
+makeExample('toh-1/ts/src/app/app.component.ts', '', 'src/app/app.component.ts')
175172

176173

177174
.l-main-section

public/docs/ts/latest/tutorial/toh-pt2.jade

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ include ../_util-fns
2727
.file styles.css
2828
.file systemjs.config.js
2929
.file tsconfig.json
30-
.file node_modules ...
30+
.file node_modules ...
3131
.file package.json
3232
:marked
3333
## Keep the app transpiling and running
@@ -46,7 +46,7 @@ code-example(language="sh" class="code-shell").
4646
:marked
4747
## Displaying heroes
4848
To display a list of heroes, you'll add heroes to the view's template.
49-
49+
5050
### Create heroes
5151
Create an array of ten heroes.
5252

@@ -65,7 +65,7 @@ code-example(language="sh" class="code-shell").
6565

6666
:marked
6767
The `heroes` type isn't defined because TypeScript infers it from the `HEROES` array.
68-
68+
6969
.l-sub-section
7070
:marked
7171
The hero data is separated from the class implementation
@@ -98,7 +98,7 @@ code-example(language="sh" class="code-shell").
9898
It indicates that the `<li>` element and its children
9999
constitute a master template.
100100

101-
The `ngFor` directive iterates over the component's `heroes` array
101+
The `ngFor` directive iterates over the component's `heroes` array
102102
and renders an instance of this template for each hero in that array.
103103

104104
The `let hero` part of the expression identifies `hero` as the template input variable,
@@ -167,7 +167,7 @@ code-example(language="sh" class="code-shell").
167167
That's the same `hero` variable you defined previously in the `ngFor` directive.
168168
.l-sub-section
169169
:marked
170-
Learn more about event binding at the
170+
Learn more about event binding at the
171171
[User Input](../guide/user-input.html) page and the
172172
[Event binding](../guide/template-syntax.html#event-binding) section of the
173173
[Template Syntax](../guide/template-syntax.html) page.
@@ -177,7 +177,7 @@ code-example(language="sh" class="code-shell").
177177
You no longer need the `hero` property because you're no longer displaying a single hero; you're displaying a list of heroes.
178178
But the user will be able to select one of the heroes by clicking on it.
179179
So replace the `hero` property with this simple `selectedHero` property:
180-
180+
181181
+makeExample('toh-2/ts/src/app/app.component.ts', 'selected-hero', 'src/app/app.component.ts (selectedHero)')
182182
:marked
183183
The hero names should all be unselected before the user picks a hero, so
@@ -197,7 +197,7 @@ code-example(language="sh" class="code-shell").
197197
### Hide the empty detail with ngIf
198198

199199
When the app loads, the `selectedHero` is undefined and won't be defined until you click a hero's name.
200-
Angular can't display properties of the undefined `selectedHero` and throws the following error,
200+
Angular can't display properties of the undefined `selectedHero` and throws the following error,
201201
visible in the browser's console:
202202

203203
code-example(format="nocode").
@@ -218,7 +218,7 @@ code-example(language="sh" class="code-shell").
218218

219219
:marked
220220
The app no longer fails and the list of names displays again in the browser.
221-
221+
222222
:marked
223223
When there is no `selectedHero`, the `ngIf` directive removes the hero detail HTML from the DOM.
224224
There are no hero detail elements or bindings to worry about.
@@ -238,7 +238,7 @@ code-example(language="sh" class="code-shell").
238238
### Style the selected hero
239239

240240
While the selected hero details appear below the list, it's difficult to identify the selected hero within the list itself.
241-
241+
242242
In the `styles` metadata that you added above, there is a custom CSS class named `selected`.
243243
To make the selected hero more visible, you'll apply this `selected` class to the `<li>` when the user clicks on a hero name.
244244
For example, when the user clicks "Magneta", it should render with a distinctive but subtle background color
@@ -247,18 +247,17 @@ code-example(language="sh" class="code-shell").
247247
figure.image-display
248248
img(src='/resources/images/devguide/toh/heroes-list-selected.png' alt="Selected hero")
249249
:marked
250-
251-
In the template, add the following `[class.selected]` binding to the `<li>`
250+
In the template, add the following `[class.selected]` binding to the `<li>`:
252251
+makeExample('toh-2/ts/app/app.component.1.html', 'class-selected-1', 'app.component.ts (setting the CSS class)')(format=".")
253252
:marked
254253
When the expression (`hero === selectedHero`) is `true`, Angular adds the `selected` CSS class.
255254
When the expression is `false`, Angular removes the `selected` class.
256-
255+
257256

258257
.l-sub-section
259258
:marked
260259
Read more about the `[class]` binding in the [Template Syntax](../guide/template-syntax.html#ngClass "Template syntax: NgClass") guide.
261-
260+
262261
:marked
263262
The final version of the `<li>` looks like this:
264263
+makeExample('toh-2/ts/app/app.component.1.html', 'class-selected-2', 'app.component.ts (styling each hero)')(format=".")

0 commit comments

Comments
 (0)