Monday, 13 March 2017

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 assigning $image by some useful image using $image.attr('src', useful_image) Using img.use--img_01 in .jade, I am able to display the image (useful_image). Now, my constraint is I don't want to hard code in .jade and let .jade display images as many as provided by .js.

So, I am able to create the array in .js of var $image=[] and then $image.push($(pclass + 'img_' + N.toString()) where N varies from 0 to K (lets say K =3).

Now I want to call these img_0, img_1, img_2 .....img_K in .jade and display them on page.

So my specific question is I am not able to iterate [img_0, img_1, img_2 .....img_K] in .jade. Can anyone tell what could be best method to do so????



via Chandra

No comments:

Post a Comment