How to pass variables through handlebars partial with JavaScript?

Spread the love

Sometimes, we want to pass variables through handlebars partial with JavaScript

In this article, we’ll lookm at how to pass variables through handlebars partial with JavaScript.

How to pass variables through handlebars partial with JavaScript?

To pass variables through handlebars partial with JavaScript, we use key value notation.

For instance, we write

{{> mypartial foo='bar' }}

to pass the foo variable to the mypartial partial template and set it to 'bar'.

Conclusion

To pass variables through handlebars partial with JavaScript, we use key value notation.

Leave a Reply

Your email address will not be published. Required fields are marked *