Jeanluca Scaljeri
Jeanluca Scaljeri

Reputation: 29109

EmberJs: How to render a template using its "data-template-name"

I have a template file which only generates some html (so there's no App.ListView). For example assume I have a "list" defined as follows:

<script type="text/x-handlebars" data-template-name="list"> 
    <div class="list">
    </div>
</script>

Now the question is how can I target this template within an other template

{{view "list" contextBinding="this"}}

Here's a jsfiddle

Any suggestions ?

Cheers

Upvotes: 2

Views: 545

Answers (1)

CraigTeegarden
CraigTeegarden

Reputation: 8251

You can use {{template}}.

jsFiddle example

<script type="text/x-handlebars" data-template-name="application">
    {{template list}}
</script>

See a related answer for a breakdown of the various helpers: Different rendering techniques in emberjs handlebars template

Upvotes: 1

Related Questions