Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handlebars @partial-block usage

I have been trying to pass a template to a partial as explained here: https://handlebarsjs.com/guide/partials.html#partial-blocks. For instance I have a file hello.hbs that contains:

Hello
{{> @partial-block }}

that I am trying to include inside another file world.html as is:

{{#> hello }}
World!
{{/hello}}

so that it should render:

Hello
World!

But if I am doing this, I am getting the error The partial @partial-block could not be found. However, if I change hello.hbs to:

Hello
{{ @partial-block }}  <!-- Removed the '>' -->

it works. Am I doing something wrong?

Thank you in advance!

like image 354
helenej Avatar asked Nov 03 '16 19:11

helenej


1 Answers

Actually I solved this issue with the comment provided here: https://github.com/wycats/handlebars.js/issues/1168#issuecomment-247010136. The error was probably happening because the partial block was not always defined for instance if I was doing:

{{#> hello }}
{{/hello}}
like image 61
helenej Avatar answered Sep 21 '22 18:09

helenej