Skip to content Skip to sidebar Skip to footer

Passing Array Of Image Objects To The Jade And Then Displaying Via Jade

Here, I have use.js and use.jade. In use.js, I am simply mapping hardcoded image variable img_01 from jade to use.js by specifying var $image= $(pclass + 'img_01'); In .js, I am as

Solution 1:

You can pass object from server to client in this way.

 app.get(..., function (req, res) {
        var stats = { ... };
        res.render('chart', { images: $arrImage });
     });

For looping at client ,you can use jade#each.

each oneImage in images
 img( src=oneImage.image)

Note : Jade is depricated,So try to use Pug#each

Post a Comment for "Passing Array Of Image Objects To The Jade And Then Displaying Via Jade"