volt : pass variable to include from parent template

218 Views Asked by At

I am beginner with volt ,

I have a template that use a partials like this

main.volt

<div>
  hello to 
  {{ partial("partials/tst",["name":"kevin"]) }}
</div>

and I use that variable like this partial/tst.volt

<b>
{{name}}
</b>

but I get an error like this

Undefined variable

how can I fix this ??

1

There are 1 best solutions below

0
On BEST ANSWER

This code are ok, I test it and get correct name in the view:

Index file capture

I have the partial like you:

Partial code capture

And finally I get this in my view:
view result