S
S
semki0962016-03-20 21:50:27
JavaScript
semki096, 2016-03-20 21:50:27

Handlebars - how to render template output in template?

Here is approximately the following code, I get an array with Ajax and form a Handlebars template, then I do the same with other data and form a second template.

$.ajax({
           url: "/node/88",
             success: function(json){
                            var data = jQuery.parseJSON(json);
                            var templ_in = Handlebars.compile( $('#templ_in').html() );
                            $('#block_1').append( templ_in(data) ); 
             }
 }).done(function send(){
 $.ajax({
             url: '/node/15',
             success: function(json){
                            var data = jQuery.parseJSON(json);
                            var templ_second = Handlebars.compile( $('#templ_second').html() );
                            $('#block_1').append( templ_second(data) ); 
...


The first pattern is rendered in the form of a cycle
{{#each post}}
{content}
{{/each}}

And I need to include the second template in the cycle of the first
{{#each post}}
{content}
{{> 2ой шаблон}}
{{/each}}

Is it possible? Please help me figure it out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan, 2016-11-18
@LiguidCool

In my opinion, there are Partials for this .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question