• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Get options sent to pug with space in the name

Resolved: Get options sent to pug with space in the name

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I am trying to send JSON options into a pug file with a space in the attribute names.
For example, inside an express get request:
How do I access this data in the pug file? It is difficult to change the format of the json because it is external and not something I made myself.

Answer:

Pug makes locals available under the locals property so you can simply use the following…
I couldn’t find any official documentation for this so it might not always be a reliable option.
Another option to make this easier would be to simply bundle all your json properties under a single object…
Then you can use something like this
Alternately, transform your object to normalise the keys
and use

If you have better answer, please add a comment about this, thank you!

express javascript node.js pug
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Vue 3 watchEffect dependency tracking after asynchronous code

22/03/2023

Resolved: Watching state object in pinia doesn’t fire when object changes

22/03/2023

Resolved: Create From/To Pairs by sequential date R dplyr

22/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.