@@ -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