Skip to content
Myr

note on locals

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 60daf0d · Browse files · 1 file+2 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−0 removed

  • other:+2 added−0 removed

1 file+2 added−0 removed

modified:docs/guide.md+2 added
537 unmodified lines
538 * _indexInCollection_ index of the object in the collection539 * _lastInCollection_ true if this is the last object540 * _collectionLength_ length of the collection541542Local variables passed (or generated) take precedence, however locals passed to the parent view are available in the child view as well. So for example if we were to render a blog post with _partial('blog/post', post)_ it would generate the _post_ local, but the view calling this function had the local _user_, it would be available to the _blog/post_ view as well.543544For documentation on altering the object name view [res.partial()](http://expressjs.com/guide.html#res-partial-view-options-).545546__NOTE:__ be careful about when you use partial collections, as rendering an array with a length of 100 means we have to render 100 views. For simple collections you may inline the iteration instead of using partial collection support to decrease overhead.547
630 unmodified lines