F
F
First Name2018-08-21 18:38:43
Pug
First Name, 2018-08-21 18:38:43

How to print one element in pug?

Hello everyone, I am passing the Json "Offers" to the template.
Through the loop I can print it

each offer,index in offers
offer.id
offer.name
offer.organizationname

But I needed the name of the first offer, I display offers[0]
The json of one object is displayed. But I can't pull out the name, I'm trying offers[0].name
{"id":366,"name":"Test","organizationname":"Test"}
Use of undefined constant name - assumed 'name'

Tell me, please, what is the problem.
Thank you in advance.
PS Sorry for such a crooked explanation :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Sokhin, 2018-08-22
@roamn

https://codepen.io/roamn/pen/GXgMyV
Codepen has no problems compiling pug.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question