1
0
mirror of https://github.com/bobwen-dev/react-templates synced 2025-04-12 00:56:39 +02:00
react-templates/test/data/scope-variable-references.rt
anchann 0c5fee07a7 In rt-scope subsequent aliases should be able to reference preceding ones
Rationale: It is typical to want to alias multiple subtrees of a nested
structure in a single rt-scope statement, like so:

<div rt-scope="this.props.user as user; user.profile as profile;
user.friends as friends">

This was not possible because of the function parameter based
implementation of rt-scope. I tweaked it a bit to use var declaration
instead, while preserving the parameter-based passing for all child
scopes.
2015-07-27 15:56:10 +09:00

12 lines
426 B
Plaintext

<div>
<div rt-repeat="foo in [1]">
<!-- can't seem to have an object literal here; will deal with this separately -->
<div rt-scope="[{first: 'Jack', last: 'Sparrow', skills: ['talking', 'fighting', 'commandeering']}][0] as pirate; pirate.first as first">
<h1>{first} {pirate.last}</h1>
<div rt-scope="pirate.skills as skills">
<span rt-repeat="skill in skills">{skill}</span>
</div>
</div>
</div>
</div>