Using `contextData` handlebars helper
See original GitHub issueI’m trying to override the text in a button in one of my view templates. I’d like to do this using contextData
, following the documentation:
<!--
The same as above, but passing in some data to override
some items in the @button-2 data. 'someData' is an
object, i.e. {text: 'foo'}
-->
{{> '@button-1' (contextData '@button-2' someData) }}
When I look at the example, @paulrobertlloyd has done it like this:
{% render "@button", { label: "Search", submit: true } %}
How do I write the same thing in Handlebars? I’ve been trying for quite a while but keep getting syntax errors. Here’s what I’ve tried (including separating with commas, adding double quotes…) but I’m missing something.
{{> '@button-1' (contextData '@button-2' {text: 'foo'} }}
What am I doing wrong here?
Really enjoying using Fractal properly, by the way! 😃
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Block Helpers - Handlebars
Block helpers make it possible to define custom iterators and other functionality that can invoke the passed block with a new context. #...
Read more >Handlebars helper: Compile template and keep @root
I'm using grunt-compile-handlebars to compile my handlebars and I have the problem, that the @root object changes after I use
Read more >hapi — Create and Use Custom Handlebars Helpers
Hapi saves the data in the context.data.root object. Let's dive into the code and have a look at each part. Actually, the context...
Read more >com.github.jknack.handlebars.Context.data java code examples ...
Best Java code snippets using com.github.jknack.handlebars.Context.data (Showing top 9 results out of 315) · AssignHelper.apply(...) · HandlebarsContextFactory.
Read more >@frctl/handlebars-helpers - npm
The render helper renders a component (referenced by it's handle) using the context data provided to it. If no data is provided, it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@joshje had a look and helped me write this:
It works! I don’t know how but it does 👍
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.