morteza mortezaie
morteza mortezaie

Reputation: 1564

volt : pass variable to include from parent template

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 ??

Upvotes: 0

Views: 256

Answers (1)

Chess
Chess

Reputation: 36

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

Upvotes: 1

Related Questions