'How can I interpolate data retrieved from an API inside of link in a pug template?
I'm looking to add ids retrieved from an api to the url of my link as indicated bellow.
I thought I could do an interpolation so I tried a(href="https://imdb.com/title/" + #{s.ids.imdb}). Well, that doesn't work. Can anyone help me with a way to get this done?
extends layout
block layout-content
h1 Popular Shows
table(style='width:40%', border='2')
each s in shows
tr
th Show Title
th Year
tr
td(style='text-align: center')
**a(href="https://imdb.com/title/") #{s.title}**
td(style='text-align: center') #{s.year}
Solution 1:[1]
Nvm! I just figured it.
Simply a(href="https://imdb.com/title/" + s.ids.imdb) #{s.title}
That solved the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jsbrcad |
