최근 검색
최근 검색 없음
Javascript and Dynamic Content
2022년 4월 04일에 게시됨
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 !
1
1
댓글 1개
Tipene Hughes
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
0
댓글을 남기려면 로그인하세요.