Skip to content

Support logical operators in HTML Template code #355

Description

@jankapunkt

I often have much redundancy when just trying to pass conditional paramters. For example:

{{#if condition}}
  {{> otherTemplate param=1}}
{{else}}
  {{> otherTemplate param=2}}
{{/if}}

alternative would be now to create another helper (because condition is shared, which I can't simply return the value from this helpert) but that increases the js code a lot for many simple conditions.

Way better would be

{{> otherTemplate param=(condition ? 1 : 2)}}

That would also make many custom Template helpers packages obsolete and thus again reduce bundle size.

Any ideas or ciritcs on that?

Activity

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions