1 Debug a template
Scott Erickson edited this page 2016-02-25 11:13:19 -08:00

Problem

You want to see what's going on within a template while it is executing.

Solution

Drop in console.log calls as you would inside a view.

Details

Jade is compiled into a JavaScript function which takes a context object and returns an HTML string. You can use any JavaScript you'd like be prefixing with -.

for item in view.items.models
  - console.log('Looping through item', item);
  p= item.get('name')

References