Skip to content

Can custom helper return object? #347

Closed
dotnet/arcade
#16884

Description

@hsamhita

"{{someParentContextField}}
{{#with helperWhichReturnsObject}}
{{fieldFromHelperReturnedObject}}
{{/with}}"

Wondering if above is feasible. Any help is appreciated.

Activity

  1. oformaniuk commented on May 17, 2020

    @oformaniuk
    Member

    Unfortunately in current version it's not possible.
    I've implemented such functionality in my fork zjklee/Handlebars.CSharp and currently working on back-porting the changes. For the whole list of changes please see zjklee/Handlebars.CSharp/pull/3
    The correct template should look like this:

    {{#with (helperWhichReturnsObject)}}
      {{fieldFromHelperReturnedObject}}
    {{/with}}

    The only difference is that you need to call the helper with return value as a sub-expression.

  2. hsamhita commented on May 17, 2020

    @hsamhita
    Author

    Thanks zjklee for the information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions