开发者

Pass variable into nested jquery template

<script id="mainTemplate" type="text/x-jquery-tmpl">

{{each(i, wrapSpec) data}}

<div id="pkgLineTabs_{{= wrapSpec.wrapSpecId}}" style="font-size:12px" 
     class="reportTable display {{= wrapSpec.wrapSpec2.pkgLineId.hash}}" title="{{= wrapSpec.wrapSpec2.pkgLineId.hash}}" >  

    {{tmpl(wrapSpec.repo开发者_如何学JAVArt) "#dayTemplate"}} <!-- need to pass avgOunces variable !-->

</div>  

{{/each}}

   <script id="dayTemplate" type="text/x-jquery-tmpl">

<!-- need avgOunces variable down here !-->


    <br />
</script>

Ok say I have a template like this. In the nested template call I want to pass a variable that the first template has so it has access to that variable. How would I go about doing that? Thanks for the help.


Never mind. I got it.

{{tmpl(reportPerHour, { avgText : avgText }) "#hourTemplate"}}

In next template

{{= $item.avgText }} 

Not sure why I need the item variable though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜