Last Updated: February 25, 2016
·
415
· leighquince

Log within handlbars

When needing to debug within a handlebars template I find it useful to be able to log straight from the template.

first define a helper

Handlebars.registerHelper('HB_log', function(context, options) {
        console.log(context);
     });

then in your template just call it with what you would like to log

{{HB_log this}}