question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using `contextData` handlebars helper

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mabancommented, Mar 6, 2017

@joshje had a look and helped me write this:

{{> @button label="Search" type="Submit" }}

It works! I don’t know how but it does 👍

0reactions
stale[bot]commented, Jul 12, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found