Runtime Parameter in Template

What is the handlebars expression for accessing a Runtime Parameter within a template?

You create a custom helper:

Handlebars.registerHelper('getParam', function() {
    return merge.template.parameters.myParam;
});

This helper returns the value of the myParam runtime parameter.

Then you use it within a handlebars expression: {{getParam}}

1 Like

When 2024.1 has been released you can simply do {{@parameters.myParam}}. No custom helper required.

In 2023.2, if you need to access multiple parameters you could consider a parameterized custom helper:

Handlebars.registerHelper('getParam', function(name) {
    return merge.template.parameters[name];
});

… which you can use like this: {{getParam 'myParam'}}

1 Like