Answer the question
In order to leave comments, you need to log in
How to get object from JS in Pug?
Help me understand, here I got an object in JS const friends = await callAPI('friends.get', { fields: 'city, country, photo_100' }); which contains a list of friends in VK. How can I get this object and use it in PUG to display all friends in the each avatar loop, name in friends for example. Thank you.
Answer the question
In order to leave comments, you need to log in
ul
each f in friends
li= f.name + f.avatar
//Для nodejs
const compiledFunction = pug.compileFile('template.pug');
//Для webpack при подключеном pug лоадере
const compiledFunction = require('template.pug');
const friends = await callAPI('friends.get', { fields: 'city, country, photo_100' });
console.log(compiledFunction({
friends
}));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question