Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Access Parent in Nested Template #34

Closed
bradintheusa opened this Issue · 1 comment

2 participants

@bradintheusa

Not sure if I just missed this but in a nested template how do i display a property from the parent object..

eg. Display the movie title in the nested template

http://borismoore.github.com/jsviews/demos/jQueryConfDemosOct2011/08b_each-composition.html

@BorisMoore
Owner

With nested templates, $parent gets you the view object whose data is the array, and $parent.parent gets you the view object of the outer template.
So to get the number of items in the array, you could do {{=$parent.data.length}}
To get the foo property of the data item in the outer context you do {{=$parent.parent.data.foo}}

For the movie example: {{=$parent.parent.data.Title}}

@BorisMoore BorisMoore closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.