Do we have any help article for handlebars integration in aem?
Solved! Go to Solution.
Views
Replies
Total Likes
There are lots of libraries available like:
Displaying data from a flat JSON file on a Handlebars.js template file rendered with AJAX. · GitHub
AngularJS
VueJs (e.g.javascript - Fliter Json to HTML using Vue JS - Stack Overflow )
Unlike using libraries you can use do with jquery or javascript if structure is not complex and repetative.
Views
Replies
Total Likes
Hi,
Not sure if you are looking for client side handlebar js or server side handle bar integration.
Check below if helps
Handle bar & AEM server side integration
http://aempodcast.com/2015/javascript/server-side-handlebars-aem/#.W3XnmmaB1AY
Views
Replies
Total Likes
Hi Arun,
I want to render json response received from ajax using any templating language. I think we can't call sightly template from ajax success method and handlebar could come to rescue here. I want to pass json response to handlebar template and then render converted html on page.
Thanks,
Rajeev
Views
Replies
Total Likes
Below is the scenario..
$.ajax({
type: 'GET',
url: 'test.json',
data: { get_param: 'value' },
dataType: 'json',
success: function (data) {
//1. use any template to convert json response to html block
//2. Set the response on page(this can be done using jquery once html block is available from template.
});
}
});
Views
Replies
Total Likes
There are lots of libraries available like:
Displaying data from a flat JSON file on a Handlebars.js template file rendered with AJAX. · GitHub
AngularJS
VueJs (e.g.javascript - Fliter Json to HTML using Vue JS - Stack Overflow )
Unlike using libraries you can use do with jquery or javascript if structure is not complex and repetative.
Views
Replies
Total Likes
Thanks Arun.
I will prefer library so that JS & html are separated. Response data is complex and therefore having html template would be a better choice.
json2html seems to be too raw and basic api compared handlebar.
Thanks for the pointers. I will try to integrate handlebar using custom clientlib and see if I encounter any issues during this process.
Thanks,
Rajeev
Views
Replies
Total Likes
Arun,
Just last question - Can we levarage HTL template to render the json response from ajax?
Views
Replies
Total Likes
Views
Likes
Replies