Hello,
Isn’t there an inconsistency in spacebars when it comes to spacebars and helpers :
Example :
//return something from helper, needs an argument (here explicitely)
{{ getSomething "withThisArgument" }}
{{each argument in ListArgument }}
//returns something from helper, needs an argument (here dynamically)
{{ getSomething argument }}
{{/each}}
{{ > Template.TemplateA }} //includes TemplateA
{{ > HelperA }} // calls the helper that returns a template
// BAM does not work. The helper cannot return a template with an argument
{{> getTemplate WithThisArgument}}
Why ? because he wants to pass arguments to the new called Template like the following :
{{> getTemplate childTemplateArgument1="arg1" childTemplateArgument2="arg2"}}
And not :
{{> getTemplate "executeHelperWithHelperArgument1" args1 ="arg1" }}
Another inconsistency I found today:
//Here the used Template Helper
getTemplatesArray: function(){
return [Template.a,Template.b]
}
Example 1 : Call multiple Templates from helper (using this) : Works
// HTML
{{#each getTemplatesArray }}
{{> this }}
{{/each}}
Example 2 : Call multiple Templates from helper and give Data Context (using this) : Does not work
// HTML
{{#each getTemplatesArray }}
{{> this test="testValue" }}
{{/each}}
Example 3 : Call multiple Templates from helper and give Data Context with different syntax (not using this) : Works
// HTML
{{#each template in getTemplatesArray }}
{{> template test="testValue" }}
{{/each}}
Doesn’t this seem inconsistent ?
Question related to spacebars execution order :
{{#each collectionOfSize3 }}
{{#if someConditionThatIsAlwaysTrueAndLogsFoo}}
{{ ConsoleLogBar }}
{{/if}}
{{/each}}
What is the expected output ? Try to do this theorethically please, I give the answer afterwords.