Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Passing data to def function #137

@samuelngs

Description

@samuelngs

I have problem accessing the data in the def function.
Just for an example, I have a data of

{"name":"Jake","age":31}

And here's a template file

{{##def.test = function(str) {
     return "My name is: " + str;
}
#}}
{{#def.test(name)}}

As I tested the result will print out "My name is:" instead of "My name is Jake".
Is there a way to passing data to def function?

something like this???:

{{#def.test("{{=it.name}}")}}

or

{{#def.test(it.name)}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions