-
-
Notifications
You must be signed in to change notification settings - Fork 453
Closed
Description
Is your feature request related to a problem? Please describe.
In multiple cases I needed a way to use setVar helper inside another helper like #repeat
Describe the solution you'd like
Allow setVar to works in a loop and have a new var for each item in the loop.
Describe alternatives you've considered
Is maybe better to post an example
{
"inputs": [
{{# repeat 6 }}
{{ setVar 'inputType' (oneOf (array 'text' 'checkbox' 'radio' )) }}
{
"type": "{{ inputType }}",
"name": "{{ faker 'git.branch' }}",
"value":
{{# switch 'inputType' }}
{{# case "text" }}"John"{{/ case }}
{{# case "textarea" }}"lorem ipsum dolor"{{/ case }}
{{# case "checkbox" }}{{ faker 'random.boolean' }}{{/ case }}
...
{{/ switch}}
"label": ""
}
{{/ repeat }}
]
}Additional context
I already tried this kind of template but I got an error Error while serving the content: Cannot set property 'inputType' of undefined I supposed this kind of setVar usage is not allowed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done (ready for next release)