Closed phillipskevin closed 6 years ago
I think this is how this should work:
../.
should skip special scope at location of .
.././foo
should skip special scope at location of .
../foo
should not skip special scopes
Putting this here to remind myself how I got this working later...
I got this working for both of the cases in:
{{#each(objects, object=value)}}
{{#each(../fields, field=value)}}
{{../object[field]}}
{{/each}}
{{/each}}
../fields
Here is how the Scope looks when accessing ../fields
:
object
- the normal scope created by {{#each objects}}
{ index }
- the "special" scope created automatically by {{#each objects}}
{ object }
- the "notContext" scope created by object=value
in {{#each objects}}
{ fields, objects }
- the ViewModel../object
Here is how the Scope looks when accessing ../object
:
field
- the normal scope created by {{#each fields}}
{ index }
- the "special" scope created automatically by {{#each fields}}
{ field }
- the "notContext" scope created by field=value
in {{#each fields}}
object
- the normal scope created by {{#each objects}}
{ index }
- the "special" scope created automatically by {{#each objects}}
{ object }
- the "notContext" scope created by object=value
in {{#each objects}}
{ fields, objects }
- the ViewModelTwo things are needed to make this work:
makeShouldSkipSpecialContexts
should not skip notContext scopes after walking up the correct number of contexts based on the parentContextWalkCount
.../../foo
should not use makeShouldExitAfterFirstNormalContext
. They should only exit after seeing more normal contexts than the parentContextWalkCount
.
@phillipskevin commented on Tue Sep 11 2018
This is broken with latest can-stache/can-view-scope because
../object
is undefined:This works with