How to pass data into ejs templates?

49 Views Asked by At

I have the following `html` snippet and I can see that it's using `ejs` and potentially some other templating engines.
<div class="swiper-slide slide7">
  <img src="~-IMAGE/img_1200x653_eBanking_03.7.png" class="d-none d-md-block d-lg-block d-sm-none" srcset="${require('-IMAGE/img_1200x653_eBanking_03.7.png')}" alt="">
  <div class="text-group-right">
    <h2 class="slide-title">${__('ebanking.dss.content.step.7.title')}</h2>
    <p class="slide-desc">${__('ebanking.dss.content.step.7.descriptions')}</p>
  </div>
</div>

I am not that familiar with ejs but am wondering if there's a way I can pass data, like the with template literals as seen in the example snippet/ image source, etc., as seen in the example, into snippets like these so it can save a lot of hassles.

1

There are 1 best solutions below

2
Gianluca On

are you passing data from the backend, if so it is nodeJs? If it is, typically you have to set the value of the data you want to pass in the function from the backend, and then pass it through when rendering the page. if this is the case, I can explain more on how to do so