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

Commit 281df32

Browse files
committed
fix snippet headers in toh1/2
1 parent 9e7e636 commit 281df32

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ include ../_util-fns
1212
.file angular-tour-of-heroes
1313
.children
1414
.file src
15-
.children
15+
.children
1616
.file app
1717
.children
1818
.file app.component.ts
@@ -47,7 +47,7 @@ code-example(language="sh" class="code-shell").
4747
Update the `AppComponent` so it has two properties:   a `title` property for the application name and a `hero` property
4848
for a hero named "Windstorm".
4949

50-
+makeExample('toh-1/ts-snippets/app.component.snippets.pt1.ts', 'app-component-1', 'app.component.ts (AppComponent class)')(format=".")
50+
+makeExample('toh-1/ts-snippets/app.component.snippets.pt1.ts', 'app-component-1', 'src/app/app.component.ts (AppComponent class)')(format=".")
5151

5252
:marked
5353
Now update the template in the `@Component` decoration with data bindings to these new properties.
@@ -71,13 +71,13 @@ code-example(language="sh" class="code-shell").
7171
Create a `Hero` class with `id` and `name` properties.
7272
For now put this near the top of the `app.component.ts` file, just below the import statement.
7373

74-
+makeExample('toh-1/ts/src/app/app.component.ts', 'hero-class-1', 'app.component.ts (Hero class)')(format=".")
74+
+makeExample('toh-1/ts/src/app/app.component.ts', 'hero-class-1', 'src/app/app.component.ts (Hero class)')(format=".")
7575

7676
:marked
7777
Now that we have a `Hero` class, let’s refactor our component’s `hero` property to be of type `Hero`.
7878
Then initialize it with an id of `1` and the name, "Windstorm".
7979

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

8282
:marked
8383
Because we changed the hero from a string to an object,
@@ -106,7 +106,7 @@ code-example(language="sh" class="code-shell").
106106
Change the quotes around the template to back-ticks and
107107
put the `<h1>`, `<h2>` and `<div>` elements on their own lines.
108108

109-
+makeExample('toh-1/ts-snippets/app.component.snippets.pt1.ts', 'multi-line-strings', 'app.component.ts (AppComponent\'s template)')
109+
+makeExample('toh-1/ts-snippets/app.component.snippets.pt1.ts', 'multi-line-strings', 'src/app/app.component.ts (AppComponent\'s template)')
110110

111111
.callout.is-important
112112
header A back-tick is not a single quote
@@ -126,7 +126,7 @@ code-example(language="sh" class="code-shell").
126126

127127
Refactor the hero name `<label>` with `<label>` and `<input>` elements as shown below:
128128

129-
+makeExample('toh-1/ts-snippets/app.component.snippets.pt1.ts', 'editing-Hero', 'app.component.ts (input element)')
129+
+makeExample('toh-1/ts-snippets/app.component.snippets.pt1.ts', 'editing-Hero', 'src/appapp.component.ts (input element)')
130130
:marked
131131
We see in the browser that the hero’s name does appear in the `<input>` textbox.
132132
But something doesn’t feel right.
@@ -145,7 +145,7 @@ code-example(language="sh" class="code-shell").
145145
of external modules used by our application.
146146
Now we have included the forms package which includes `ngModel`.
147147

148-
+makeExample('toh-1/ts/src/app/app.module.ts', '', 'app.module.ts (FormsModule import)')
148+
+makeExample('toh-1/ts/src/app/app.module.ts', '', 'src/app/app.module.ts (FormsModule import)')
149149

150150
.l-sub-section
151151
:marked
@@ -181,7 +181,7 @@ code-example(language="html").
181181

182182
Here's the complete `app.component.ts` as it stands now:
183183

184-
+makeExample('toh-1/ts/src/app/app.component.ts', 'pt1', 'app.component.ts')
184+
+makeExample('toh-1/ts/src/app/app.component.ts', 'pt1', 'src/app/app.component.ts')
185185

186186
.l-main-section
187187
:marked

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

+15-15
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ code-example(language="sh" class="code-shell").
5050
### Creating heroes
5151
Let’s create an array of ten heroes.
5252

53-
+makeExample('toh-2/ts/src/app/app.component.ts', 'hero-array', 'app.component.ts (hero array)')
53+
+makeExample('toh-2/ts/src/app/app.component.ts', 'hero-array', 'src/app/app.component.ts (hero array)')
5454

5555
:marked
5656
The `HEROES` array is of type `Hero`, the class defined in part one,
@@ -61,7 +61,7 @@ code-example(language="sh" class="code-shell").
6161
### Exposing heroes
6262
Let’s create a public property in `AppComponent` that exposes the heroes for binding.
6363

64-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'hero-array-1', 'app.component.ts (hero array property)')
64+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'hero-array-1', 'src/app/app.component.ts (hero array property)')
6565

6666
:marked
6767
We did not have to define the `heroes` type. TypeScript can infer it from the `HEROES` array.
@@ -76,7 +76,7 @@ code-example(language="sh" class="code-shell").
7676
Our component has `heroes`. Let’s create an unordered list in our template to display them.
7777
We’ll insert the following chunk of HTML below the title and above the hero details.
7878

79-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'heroes-template-1', 'app.component.ts (heroes template)')
79+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'heroes-template-1', 'src/app/app.component.ts (heroes template)')
8080

8181
:marked
8282
Now we have a template that we can fill with our heroes.
@@ -89,7 +89,7 @@ code-example(language="sh" class="code-shell").
8989

9090
First modify the `<li>` tag by adding the built-in directive `*ngFor`.
9191

92-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'heroes-ngfor-1', 'app.component.ts (ngFor)')
92+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'heroes-ngfor-1', 'src/app/app.component.ts (ngFor)')
9393

9494
.alert.is-critical
9595
:marked
@@ -118,7 +118,7 @@ code-example(language="sh" class="code-shell").
118118
Now we insert some content between the `<li>` tags
119119
that uses the `hero` template variable to display the hero’s properties.
120120

121-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'ng-for', 'app.component.ts (ngFor template)')(format=".")
121+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'ng-for', 'src/app/app.component.ts (ngFor template)')(format=".")
122122

123123
:marked
124124
When the browser refreshes, we see a list of heroes!
@@ -130,7 +130,7 @@ code-example(language="sh" class="code-shell").
130130
Let’s add some styles to our component by setting the `styles` property on the `@Component` decorator
131131
to the following CSS classes:
132132

133-
+makeExample('toh-2/ts/src/app/app.component.ts', 'styles', 'app.component.ts (styles)')(format=".")
133+
+makeExample('toh-2/ts/src/app/app.component.ts', 'styles', 'src/app/app.component.ts (styles)')(format=".")
134134

135135
:marked
136136
Notice that we again use the back-tick notation for multi-line strings.
@@ -143,7 +143,7 @@ code-example(language="sh" class="code-shell").
143143

144144
Our template for displaying the heroes should now look like this:
145145

146-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'heroes-styled', 'app.component.ts (styled heroes)')
146+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'heroes-styled', 'src/app/app.component.ts (styled heroes)')
147147

148148
.l-main-section
149149
:marked
@@ -159,7 +159,7 @@ code-example(language="sh" class="code-shell").
159159
### Click event
160160
We modify the `<li>` by inserting an Angular event binding to its click event.
161161

162-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'selectedHero-click', 'app.component.ts (template excerpt)')
162+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'selectedHero-click', 'src/app/app.component.ts (template excerpt)')
163163

164164
:marked
165165
Focus on the event binding
@@ -189,21 +189,21 @@ code-example(language="sh" class="code-shell").
189189
We no longer need the static `hero` property of the `AppComponent`.
190190
**Replace** it with this simple `selectedHero` property:
191191

192-
+makeExample('toh-2/ts/src/app/app.component.ts', 'selected-hero', 'app.component.ts (selectedHero)')
192+
+makeExample('toh-2/ts/src/app/app.component.ts', 'selected-hero', 'src/app/app.component.ts (selectedHero)')
193193

194194
:marked
195195
We’ve decided that none of the heroes should be selected before the user picks a hero so
196196
we won’t initialize the `selectedHero` as we were doing with `hero`.
197197

198198
Now **add an `onSelect` method** that sets the `selectedHero` property to the `hero` the user clicked.
199-
+makeExample('toh-2/ts/src/app/app.component.ts', 'on-select', 'app.component.ts (onSelect)')
199+
+makeExample('toh-2/ts/src/app/app.component.ts', 'on-select', 'src/app/app.component.ts (onSelect)')
200200

201201
:marked
202202
We will be showing the selected hero's details in our template.
203203
At the moment, it is still referring to the old `hero` property.
204204
Let’s fix the template to bind to the new `selectedHero` property.
205205

206-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'selectedHero-details', 'app.component.ts (template excerpt)')
206+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'selectedHero-details', 'src/app/app.component.ts (template excerpt)')
207207
:marked
208208
### Hide the empty detail with ngIf
209209

@@ -223,7 +223,7 @@ code-example(language="sh" class="code-shell").
223223
We wrap the HTML hero detail content of our template with a `<div>`.
224224
Then we add the `ngIf` built-in directive and set it to the `selectedHero` property of our component.
225225

226-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'ng-if', 'app.component.ts (ngIf)')
226+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'ng-if', 'src/app/app.component.ts (ngIf)')
227227

228228
.alert.is-critical
229229
:marked
@@ -265,12 +265,12 @@ code-example(language="sh" class="code-shell").
265265

266266
The key is the name of the CSS class (`selected`). The value is `true` if the two heroes match and `false` otherwise.
267267
We’re saying “*apply the `selected` class if the heroes match, remove it if they don’t*”.
268-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'class-selected-1', 'app.component.ts (setting the CSS class)')(format=".")
268+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'class-selected-1', 'src/app/app.component.ts (setting the CSS class)')(format=".")
269269
:marked
270270
Notice in the template that the `class.selected` is surrounded in square brackets (`[]`).
271271
This is the syntax for a **property binding**, a binding in which data flows one way
272272
from the data source (the expression `hero === selectedHero`) to a property of `class`.
273-
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'class-selected-2', 'app.component.ts (styling each hero)')(format=".")
273+
+makeExample('toh-2/ts-snippets/app.component.snippets.pt2.ts', 'class-selected-2', 'src/app/app.component.ts (styling each hero)')(format=".")
274274

275275
.l-sub-section
276276
:marked
@@ -289,7 +289,7 @@ code-example(language="sh" class="code-shell").
289289

290290
Here's the complete `app.component.ts` as it stands now:
291291

292-
+makeExample('toh-2/ts/src/app/app.component.ts', '', 'app.component.ts')
292+
+makeExample('toh-2/ts/src/app/app.component.ts', '', 'src/app/app.component.ts')
293293

294294
.l-main-section
295295
:marked

0 commit comments

Comments
 (0)