Search code examples
htmlvue.jsejs

Passing Vue data into Ejs include()


Look please

<div v-for="food in foods">
        <%- include('../partials/navbar', {food:food}); %>
</div>

Here I'm trying to pass food from foods array using Vue into Ejs include() function. Does anybody know how to make it work?


Solution

  • Use component instead:

    <navbar v-bind='food' />
    

    More about props: https://ru.vuejs.org/v2/guide/components-props.html More about components https://ru.vuejs.org/v2/guide/components-registration.html