Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide hooks(placeholder) or helper method for mixining template #172

Closed
icai opened this issue Aug 12, 2015 · 1 comment
Closed

provide hooks(placeholder) or helper method for mixining template #172

icai opened this issue Aug 12, 2015 · 1 comment
Labels

Comments

@icai
Copy link

icai commented Aug 12, 2015

My idea is that the view method in backbone or other mv* framework can Mixin by several component, the template is difficult to mixin template.

main template

<div class="feed-list-item">
    <h2 class="sr-only">{{=it.user.display_name}} submitted the post on {{=it.display_ctime}}</h2>  
    <# subtemplate #>
</div>

<# subtemplate #>

<a href="{{=it.url}}" target="_blank" class="task-url" >Go to Task</a>

on render method, I can mixin the template first (just use replace), how ever if I don't mixin this. do.template would hlep me remove this hook(placeholder)(<# subtemplate #>) in main template.


You may say that you can use conditional logic in template. Obviously you know the component would be not complete(lose the template).

maintemplate = maintemplate.replace('<# subtemplate #>', subtemplate);

before I do dot.template(maintemplate), dot.template would clean the hooks(placeholder) if have.

@epoberezkin
Copy link
Collaborator

doT supports macros ( {{##def.something: ... #}} ) and you can pass helpers methods in template in three ways:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants