Javascript and Dynamic Content
Hey there,
I'm currently working on Zendesk themes customizations and I'm using dynamic content helpers inside my javascript file (to be specific inside new_request.hbs page), in this particular way:
console.log(`{{ dc 'general_question' }}`);
But I would like to make my logic more dynamic, so I want to add variables inside the dynamic content helper, is this an option ? For example:
console.log(`{{ dc '${javascript_variable}' }}`);
I tried this approach but didn't work, maybe you guys have an idea ?
Thanks !
I tried this approach but didn't work, maybe you guys have an idea ?
Thanks !
-
Hey Carlos,
You can't use javascript variables to dynamically set the parameters of a handlebars helper, unfortunately. Depending on your use case, one way you could go about this is by conditionally rendering the appropriate dynamic content using #is statements in your .hbs template files.
Feel free to reach out with any questions!
Tipene
Iniciar sesión para dejar un comentario.
1 Comentarios