ember.js - Is it possible to include custom args in an Ember partial? -


there's piece of code in template that's repeated multiple times through it... want dry it. it's simple piece of code no logic on it.

first, though creating array title , values loop, remembered handlebars not allow me it.

second, though on partials. they're part of template, afterall. noticed apparently ignores additional arguments. thus, there's no way alter it's contents besides what's in model. in , in prior case, didn't want mess route/controller template-only variables.

third, current solution component, seems so dirty. however, it's quite troublesome have js file empty object; furthermore, components have no file structure, , wanted piece of code live along it's original template.

this simplification of wanted achieve:

project/index.hbs

{{partial "counter_block" value=model.count_success title="yeah!"}} {{partial "counter_block" value=model.count_failures title="boo :("}} 

project/_counter_block.hbs

<div>     <h2>{{title}}</h2>     <span>{{value}}</span> </div> 

is there solution matter or case handlebars oversimplification causes coding issues?

that's when create component, js file isn't necessary, can have template components/counter-block

{{counter-block value=model.count_success title='yeah!'}}  {{counter-block value=model.count_failures title='booo!'}} 

http://emberjs.jsbin.com/suxebehaqe/1/edit


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -