Search code examples
apostrophe-cmsnunjucks

How can I render nunjucks template from controller


I want to render html of another module with some data to be passed. I am trying like -

return res.send(self.render(req, 'my-module:widget.html', { temprature: 65 }))

I am trying to console temprature variable in nunjucks template(like {{apos.log(temprature)}}), I am getting undefined

Please help!


Solution

  • The object your passing to the template will be called data so you should have access to data.temperature