ember.js - Replace string in HTMLbars/Handlebars expression with component -
i've got blog. each blog-posts can have multiple downloads. downloads created component downloads
render them @ end of each post this:
{{#each download in sorteddownloads }} <p> <a class="dl-button" {{ action "incdownload" download }}> {{ download.name }} ({{ download.size}}mb) </a> - {{ download.downloadcount }} hits </p> {{/each}}
i'd able write [downloads]
in post content (which rendered via {{{post.parsedbody}}}
and replace partial above one.
is possible or have better way achieve this?
this not achievable using either outlet
or yield
, since post content not interpreted render engine.
what should working though have placeholder in content mentioned it, , replace identifiable html placeholder in post.parsedbody
. create view
on didinsertelement
, , call view's appendto()
method render downloads inside placeholder.
one writing jquery-ish elements works, think inserting arbitrary elements in views tree horrible , goes against ember way of managing views tree.
cheers!
Comments
Post a Comment