javascript - Interpret ember templates twice? -


i have template loops through array of navigation links. use ember linkto helper links.

my template:

<script type="text/x-handlebars" id="_sidenav">     <div id="sidenav">           <ul>         {{#each model.sidenav}}         <li>{{link}}             <a>                 <i {{bindattr class="iconclass"}}></i><p>{{label}}</p>             </a>         </li>     {{/each}}     </div> </script> 

my model:

[     {         "label": "overview",         "iconclass": "icon-overview",         "link": "{{#linkto overview}}hello{{/linkto}}"     }, {         "label": "posts",         "iconclass": "posts",         "link": "{{#linkto totalenergy}}hello{{/linkto}}"     } ] 

you can see have put linkto helpers in model, doesn't make sense, , of course text "{{#linkto totalenergy}}hello{{/linkto}}" appearing on page.

but think can see trying @ here, , think helpful able use templates generate other templates. actual navigation has 12+ links change based on server data , relevant on page.

i feel hack make work, not initializing ember app until handlebars templates have been run, im wondering if has better idea.

thanks

i think more simple return metadata links, like:

app.menucontroller = ember.arraycontroller.create({     content: [         {"route": "student", "title": "student info page"},          {"route": "payments", "title": "payments , pricing"},          {"route": "policy", "title": "mine"},          {"route": "biography", "title": "about me"}     ] }); 

and set in templates using:

{{#each routeobject in app.menucontroller}}     {{#linkto routeobject.route}}{{routeobject.title}}{{/linkto}} {{/each}} 

but enable binding of linkto object. needed set:

ember.env = {     helper_param_lookups: true } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -