javascript - Load handlebars js partial with different data -
is there way use partial include different data in it? or in other words, can include template handlebars template in template?
basically this:
<script id="countries-nav" type="text/x-handlebars-template"> {{#each this}} <li class="item"><a href="#/countries/{{iso}}">{{country}}</a></li> {{/each}} </script> <script id="countryspecifics" type="text/x-handlebars-template"> {{#each this}} <div class="country__title"> <h2>{{title}}</h2> </div> {{> countries-nav}} {{/each}} </script>
this basic functionality of blaze:
<template name="countries-nav"> {{#each this}} <li class="item"><a href="#/countries/{{iso}}">{{country}}</a</li> {{/each}} </template> <template name="countryspecifics"> {{#each this}} <div class="country__title"> <h2>{{title}}</h2> </div> {{> countries-nav}} {{/each}} </template>
Comments
Post a Comment