N
N
Nadia2017-06-25 14:24:02
Pug
Nadia, 2017-06-25 14:24:02

Pug. How to pass value to href?

Good afternoon. Help, please, to understand. In jade, this code worked, in pug it gives an incorrect result:

ul
    - var menu = {'#courses' : 'Направление', '#trainers' : 'Тренеры'}
    each value, key in menu
      li
        a(href="#{key}") #{value}

at the exit:
<ul>
      <li><a href="#{key}">Направление</a></li>
      <li><a href="#{key}">Тренеры</a></li>
</ul>

and you need this:
<ul>
      <li><a href="#courses">Направление</a></li>
      <li><a href="#trainers">Тренеры</a></li>
</ul>

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Khokhlov, 2017-06-25
@andrhohlov

a(href=key)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question