meteor / meteor/blaze

Support logical operators in HTML Template code

Open
#355 1 comment 2 reactions 0 assignees Claimed by @dupontbertrand View on GitHub
Dominant language
JavaScript
Stars
543
Forks
117
Avg merge
6h 18m
Merged PRs (30d)
2

Description

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

```html
{{#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

```html
{{> 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?

Contributor guide

Open the contributing guide

Research direction

The payload names no files or tests. Start by reviewing the conditional-template examples and linked pull request #500 to understand the proposed syntax and current status; done should mean a defined logical-operator form supports the shown conditional parameter without an extra helper.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.