@@ -58,15 +58,15 @@ installing component-test
58
58
59
59
This generates a JavaScript file:
60
60
61
- ``` javascript {data-file=src/ui/ components/blog-post/component .js}
61
+ ``` javascript {data-filename=app/ components/blog-post.js}
62
62
import Component from ' @glimmer/component' ;
63
63
64
64
export default class BlogPost extends Component {}
65
65
```
66
66
67
67
And a template file:
68
68
69
- ``` handlebars {data-filename=src/ui /components/blog-post/template .hbs}
69
+ ``` handlebars {data-filename=app/templates /components/blog-post.hbs}
70
70
{{yield}}
71
71
```
72
72
@@ -77,10 +77,10 @@ will be covered later on in the guides.
77
77
78
78
Templates in components use the Handlebars templating language, as discussed in
79
79
the [ Templating] ( ../../templating ) section. A component's template is the layout
80
- that is used when rendering the component. If we update the ` HelloButton ` 's
80
+ that is used when rendering the component. If we update the ` BlogPost ` 's
81
81
template to be:
82
82
83
- ``` handlebars {data-filename=src/ui /components/hello -post/template .hbs}
83
+ ``` handlebars {data-filename=app/templates /components/blog -post.hbs}
84
84
<h1>Fun Facts About Tomster</h1>
85
85
<section>
86
86
1. He's a hamster!
@@ -90,7 +90,7 @@ template to be:
90
90
91
91
And then use the component like so:
92
92
93
- ``` handlebars {data-filename=src/ui/routes/ application/route .hbs}
93
+ ``` handlebars {data-filename=app/templates/ application.hbs}
94
94
<BlogPost/>
95
95
```
96
96
@@ -107,7 +107,7 @@ This template doesn't have anything dynamic in it yet, so the output is exactly
107
107
the same as the template. We can add dynamic values directly by using double
108
108
curly syntax:
109
109
110
- ``` handlebars {data-filename=src/ui /components/blog-post/template .hbs}
110
+ ``` handlebars {data-filename=app/templates /components/blog-post.hbs}
111
111
<h1>{{@title}}</h1>
112
112
<section class="{{this.sectionClass}}">
113
113
{{@content}}
@@ -141,7 +141,7 @@ important to note that arguments and properties can be used interchangeably, so
141
141
we could for instance have used an argument for the ` sectionClass ` , and a
142
142
class property for title or post content:
143
143
144
- ``` handlebars {data-filename=src/ui /components/blog-post/template .hbs}
144
+ ``` handlebars {data-filename=app/templates /components/blog-post.hbs}
145
145
<h1>{{this.title}}</h1>
146
146
<section class="{{@sectionClass}}">
147
147
{{this.content}}
@@ -158,7 +158,7 @@ to the component where it is used.
158
158
You can also use template helpers, modifiers, and other components within your
159
159
component template:
160
160
161
- ``` handlebars {data-filename=src/ui /components/blog-post/template .hbs}
161
+ ``` handlebars {data-filename=app/templates /components/blog-post.hbs}
162
162
<h1>{{capitalize @title}}</h1>
163
163
164
164
<BlogSection>
@@ -184,7 +184,7 @@ helper allows us to specify that users can pass the component a _block_ of
184
184
children, and where those children should be placed. If we go back to our
185
185
` BlogPost ` component, we can add a yield like this:
186
186
187
- ``` handlebars {data-filename=src/ui /components/blog-post/template .hbs}
187
+ ``` handlebars {data-filename=app/templates /components/blog-post.hbs}
188
188
<h1>{{@title}}</h1>
189
189
<section class="{{this.sectionClass}}">
190
190
{{yield}}
@@ -225,7 +225,7 @@ statements in a component block, and these will be inserted in the yield:
225
225
A final thing that component templates can have is ` ...attributes ` , which can be
226
226
placed on any HTML element or component within the component's template:
227
227
228
- ``` handlebars {data-filename=src/ui /components/blog-post/template .hbs}
228
+ ``` handlebars {data-filename=app/templates /components/blog-post.hbs}
229
229
<h1>{{@title}}</h1>
230
230
<section ...attributes class="{{this.sectionClass}}">
231
231
{{yield}}
@@ -262,11 +262,11 @@ own state, such as components that focus on presentation and formatting of data.
262
262
For example, you could make a Template-Only greeting component that receives the
263
263
name of a friend and greets them:
264
264
265
- ``` handlebars {data-filename=src/ui /components/greeting/template .hbs}
265
+ ``` handlebars {data-filename=app/templates /components/greeting.hbs}
266
266
<p>Hello {{@friend}}</p>
267
267
```
268
268
269
- ``` handlebars {data-filename=src/ui/routes/ application/template .hbs}
269
+ ``` handlebars {data-filename=app/templates/ application.hbs}
270
270
<Greeting @friend="Toby"/>
271
271
```
272
272
@@ -277,7 +277,7 @@ discussed in detail in the [Working With
277
277
JavaScript] ( ../../working-with-javascript/native-classes ) section of the guides.
278
278
You can define a component class like so:
279
279
280
- ``` js {data-file=src/ui/ components/blog-post/component .js}
280
+ ``` js {data-filename=app/ components/blog-post.js}
281
281
import Component from ' @glimmer/component' ;
282
282
283
283
export default class BlogPost extends Component {}
@@ -294,33 +294,33 @@ You can add methods and fields to the component, and then access them from the
294
294
component's template. For instance, we could add the ` sectionClass ` property
295
295
that is referenced in the template for the ` BlogPost ` component from earlier:
296
296
297
- ``` handlebars {data-filename=src/ui /components/blog-post/template .hbs}
297
+ ``` handlebars {data-filename=app/templates /components/blog-post.hbs}
298
298
<h1>{{@title}}</h1>
299
299
<section ...attributes class="{{this.sectionClass}}">
300
300
{{yield}}
301
301
</section>
302
302
```
303
303
304
- ``` js {data-file=src/ui/ components/blog-post/component .js}
304
+ ``` js {data-filename=app/ components/blog-post.js}
305
305
import Component from ' @glimmer/component' ;
306
306
307
307
export default class HelloButton extends Component {
308
308
sectionClass = ' blog-post-section' ;
309
309
}
310
310
```
311
311
312
- You can also use JavaScript accessors (_ getters_ and \_ setters ) to derive values
312
+ You can also use JavaScript accessors (_ getters_ and _ setters _ ) to derive values
313
313
that need to be calculated. For instance, we could provide a default title to
314
314
the blog post if one wasn't provided:
315
315
316
- ``` handlebars {data-filename=src/ui /components/blog-post/template .hbs}
316
+ ``` handlebars {data-filename=app/templates /components/blog-post.hbs}
317
317
<h1>{{this.title}}</h1>
318
318
<section ...attributes class="{{this.sectionClass}}">
319
319
{{yield}}
320
320
</section>
321
321
```
322
322
323
- ``` js {data-file=src/ui/ components/blog-post/component .js}
323
+ ``` js {data-filename=app/ components/blog-post.js}
324
324
import Component from ' @glimmer/component' ;
325
325
326
326
export default class HelloButton extends Component {
@@ -337,7 +337,7 @@ differently in the class.
337
337
Methods can also be defined on the class and called from the template. These are
338
338
known as _ actions_ , and are decorated with the ` @action ` decorator.
339
339
340
- ``` handlebars {data-filename=src/ui /components/blog-post/template .hbs}
340
+ ``` handlebars {data-filename=app/templates /components/blog-post.hbs}
341
341
<h1>{{this.title}}</h1>
342
342
<section ...attributes class="{{this.sectionClass}}">
343
343
{{yield}}
@@ -348,7 +348,7 @@ known as _actions_, and are decorated with the `@action` decorator.
348
348
</section>
349
349
```
350
350
351
- ``` js {data-file=src/ui/ components/blog-post/component .js}
351
+ ``` js {data-filename=app/ components/blog-post.js}
352
352
import Component from ' @glimmer/component' ;
353
353
354
354
export default class HelloButton extends Component {
0 commit comments