Open sulthanmamusa opened 3 years ago
Hi, after a lot of guessing, I discovered that this way is possible to send data to handlebars and pug:
this.pdfService.toStream('template', {
locals: {
title: 'My title',
},
});
@smatioli if you could , please post a sample template as well where this variables are replaced.
doctype html
html(lang="en")
head
title= title
script(type='text/javascript').
body
h1 #{locals.title} - node template engine
#container.col
if youAreUsingPug
p You are amazing
else
p Get on it!
p.
Pug is a terse and simple templating language with a
strong focus on performance and powerful features.
try these sample template to get the title passed as variable in your pdf
Hello, if you have to make an iteration, how do you pass the array data? thanks!
ul
- var count = 0;
each item in items
if count < 3
li= item.name
- count++;
try this please
how to send data from service to template engine ( pug, handlebars etc.. )