Skip to content

Commit fa8a7b0

Browse files
author
Cerem Cem ASLAN
committed
added temporary variable usage document
1 parent 5d8fc55 commit fa8a7b0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'''
2+
Temporary Variable inside an `each` loop:
3+
4+
{{#each myobj}}
5+
{{ @context.set('._tmp1', (.foo !== 'bar')) && '' }}
6+
...
7+
{{/each}}
8+
9+
or by using `<tmp />` component:
10+
11+
{{#each myobj}}
12+
<tmp key="._tmp1" value="{{.foo !== 'bar'}}" />
13+
...
14+
{{/each}}
15+
16+
'''
17+
Ractive.components['tmp'] = Ractive.extend do
18+
template: ''
19+
isolated: no
20+
on:
21+
init: (ctx) ->
22+
ctx.set @get('key'), @get('value')

0 commit comments

Comments
 (0)